Comparing version 2.3.2 to 2.3.3
@@ -18,5 +18,3 @@ const methods = ['get', 'delete', 'patch', 'post', 'put', 'head', 'options'] | ||
maxParamLength: options.maxParamLength || 100, | ||
defaultRoute: (req, res) => { | ||
res.send(404) | ||
} | ||
defaultRoute: options.defaultRoute || ((req, res) => res.send(404)) | ||
}) | ||
@@ -23,0 +21,0 @@ |
@@ -6,3 +6,2 @@ /** | ||
*/ | ||
const util = require('util') | ||
@@ -12,17 +11,24 @@ const EventEmitter = require('events') | ||
// extending turbo-http Response class | ||
/** | ||
* extending turbo-http Response class from EventEmitter | ||
*/ | ||
const Response = require('turbo-http/lib/response') | ||
util.inherits(Response, EventEmitter) | ||
/** | ||
* creating turbo-http server instance | ||
*/ | ||
const server = module.exports = turbo.createServer() | ||
// populating req.headers for backward compatibility | ||
/** | ||
* ensure restana 'req' object compatibility | ||
*/ | ||
server.on('request', (req, res) => { | ||
setImmediate(() => { | ||
if (!req.headers) { | ||
var headers = req.getAllHeaders() | ||
// populating req.headers if missing | ||
const headers = req.getAllHeaders() | ||
if (headers instanceof Map) { | ||
req.headers = {} | ||
headers.forEach(function (v, k) { | ||
req.headers[k] = v | ||
}) | ||
headers.forEach((v, k) => (req.headers[k] = v)) | ||
} else { | ||
@@ -29,0 +35,0 @@ req.headers = headers |
{ | ||
"name": "restana", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Super fast and minimalist web framework for building REST micro-services.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# restana | ||
[![Build Status](https://travis-ci.org/jkyberneees/ana.svg?branch=master)](https://travis-ci.org/jkyberneees/ana) | ||
[![NPM version](https://img.shields.io/npm/v/restana.svg?style=flat)](https://www.npmjs.com/package/restana) [![Greenkeeper badge](https://badges.greenkeeper.io/jkyberneees/ana.svg)](https://greenkeeper.io/) | ||
[![NPM version](https://img.shields.io/npm/v/restana.svg?style=flat)](https://www.npmjs.com/package/restana) | ||
Blazing fast, tiny and minimalist *connect-like* web framework for building REST micro-services. | ||
@@ -38,2 +38,3 @@ > Uses 'find-my-way' blazing fast router: https://www.npmjs.com/package/find-my-way | ||
- `maxParamLength`: Dfines the custom length for parameters in parametric (standard, regex and multi) routes. | ||
- `defaultRoute`: Default route handler when no route match occurs. Default value: `((req, res) => res.send(404))` | ||
@@ -231,2 +232,4 @@ #### Example usage: | ||
## Performance comparison (framework overhead) | ||
> measurements below refers to version 2.3.0 (current version is faster) | ||
[Performance comparison](performance/) for a basic *Hello World!* response (single thread process). | ||
@@ -258,1 +261,4 @@ Node version: v10.11.0 | ||
> [Polka](https://github.com/lukeed/polka) micro-framework is not considered because it misses JSON response auto-detection. | ||
### Which is the fastest? | ||
You can also checkout `restana` performance index on the ***"Which is the fastest"*** project: https://github.com/the-benchmarker/web-frameworks#full-table-1 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15190
194
261