Skip to content

Commit

Permalink
chore(release): v0.12.0 (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
naorpeled authored Jan 13, 2023
1 parent a92db52 commit 486492c
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 99 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2018 Jeremy Daly
Copyright (c) 2017-2023 Jeremy Daly

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
33 changes: 8 additions & 25 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @version 0.11.0
* @license MIT
*/

const REQUEST = require('./lib/request'); // Resquest object
const RESPONSE = require('./lib/response'); // Response object
const UTILS = require('./lib/utils'); // Require utils library
const LOGGER = require('./lib/logger'); // Require logger library
const prettyPrint = require('./lib/prettyPrint'); // Pretty print for debugging
const { ConfigurationError } = require('./lib/errors'); // Require custom errors

// Create the API class
const REQUEST = require('./lib/request');
const RESPONSE = require('./lib/response');
const UTILS = require('./lib/utils');
const LOGGER = require('./lib/logger');
const prettyPrint = require('./lib/prettyPrint');
const { ConfigurationError } = require('./lib/errors');

class API {
// Create the constructor function.
constructor(props) {
// Set the version and base paths
this._version = props && props.version ? props.version : 'v1';
this._base =
props && props.base && typeof props.base === 'string'
Expand Down Expand Up @@ -51,16 +41,12 @@ class API {
? props.compression
: false;

// Set sampling info
this._sampleCounts = {};

// Init request counter
this._requestCount = 0;

// Track init date/time
this._initTime = Date.now();

// Logging levels
this._logLevels = {
trace: 10,
debug: 20,
Expand All @@ -70,13 +56,11 @@ class API {
fatal: 60,
};

// Configure logger
this._logger = LOGGER.config(props && props.logger, this._logLevels);

// Prefix stack w/ base
this._prefix = this.parseRoute(this._base);

// Stores route mappings
this._routes = {};

// Init callback
Expand All @@ -94,7 +78,6 @@ class API {
// Global error status (used for response parsing errors)
this._errorStatus = 500;

// Methods
this._methods = [
'get',
'post',
Expand All @@ -110,7 +93,7 @@ class API {
this._methods.forEach((m) => {
this[m] = (...a) => this.METHOD(m.toUpperCase(), ...a);
});
} // end constructor
}

// METHOD: Adds method, middleware, and handlers to routes
METHOD(method, ...args) {
Expand Down
7 changes: 0 additions & 7 deletions lib/compression.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

const zlib = require('zlib');

const defaultEnabledEcodings = ['gzip', 'deflate'];
Expand Down
7 changes: 0 additions & 7 deletions lib/errors.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

// Custom error types

class RouteError extends Error {
Expand Down
7 changes: 0 additions & 7 deletions lib/logger.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

// IDEA: add unique function identifier
// IDEA: response length
// https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference
Expand Down
7 changes: 0 additions & 7 deletions lib/mimemap.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

// Minimal mime map for common file types

module.exports = {
Expand Down
7 changes: 0 additions & 7 deletions lib/prettyPrint.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

module.exports = (routes) => {
let out = '';

Expand Down
7 changes: 0 additions & 7 deletions lib/request.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

const QS = require('querystring'); // Require the querystring library
const UTILS = require('./utils'); // Require utils library
const LOGGER = require('./logger'); // Require logger library
Expand Down
7 changes: 0 additions & 7 deletions lib/response.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

const UTILS = require('./utils.js');

const fs = require('fs'); // Require Node.js file system
Expand Down
7 changes: 0 additions & 7 deletions lib/s3-service.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

// Require AWS SDK
const AWS = require('aws-sdk'); // AWS SDK

Expand Down
7 changes: 0 additions & 7 deletions lib/statusCodes.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

// HTTP status code map (IANA Status Code Registry)

module.exports = {
Expand Down
7 changes: 0 additions & 7 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
'use strict';

/**
* Lightweight web framework for your serverless applications
* @author Jeremy Daly <jeremy@jeremydaly.com>
* @license MIT
*/

const QS = require('querystring'); // Require the querystring library
const crypto = require('crypto'); // Require Node.js crypto library
const { FileError } = require('./errors'); // Require custom errors
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lambda-api",
"version": "0.11.2",
"version": "0.12.0",
"description": "Lightweight web framework for your serverless applications",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 486492c

Please sign in to comment.