Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

restana

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restana - npm Package Compare versions

Comparing version 2.14.0 to 3.0.0

12

libs/response-extensions.js

@@ -0,1 +1,3 @@

const CONTENT_TYPE_HEADER = 'content-type'
/**

@@ -41,7 +43,11 @@ * The friendly 'res.send' method

}
if (options.disableResponseEvent !== true) { res.emit('response', params) }
if (options.disableResponseEvent !== true) {
res.emit('response', params)
}
if (typeof data === 'object' && data instanceof Buffer === false) {
// transparently setting the 'content-type' header if JSON
res.setHeader('content-type', 'application/json')
if (!res.hasHeader(CONTENT_TYPE_HEADER)) {
// transparently setting the 'content-type' header if JSON
res.setHeader(CONTENT_TYPE_HEADER, 'application/json')
}
params.data = JSON.stringify(params.data)

@@ -48,0 +54,0 @@ }

{
"name": "restana",
"version": "2.14.0",
"version": "3.0.0",
"description": "Super fast and minimalist web framework for building REST micro-services.",

@@ -60,5 +60,4 @@ "main": "index.js",

"supertest": "^3.4.2",
"turbo-http": "^0.3.2",
"winston": "^2.4.4"
}
}

@@ -5,2 +5,3 @@ # restana

Blazing fast, tiny and minimalist *connect-like* web framework for building REST micro-services.
[> Check how much faster!](https://github.com/the-benchmarker/web-frameworks#full-table-1)
> Uses 'find-my-way' router: https://www.npmjs.com/package/find-my-way

@@ -249,57 +250,11 @@

## turbo-http integration
What is turbo-http? Checkout: https://www.npmjs.com/package/turbo-http
Using `turbo-http` in restana:
```bash
npm i turbo-http
```
```js
// ATTENTION: The performance of the service below can blow your mind ;)
const server = require('restana/libs/turbo-http')
const service = require('restana')({
server
})
service.get('/hi', (req, res) => {
res.send({
msg: 'Hello World!'
})
})
service.start()
```
> NOTE: When using `turbo-http`, the node.js `cluster` module can't be used!
## Performance comparison (framework overhead)
> measurements below refers to version 2.4
[Performance comparison](performance/) for a basic *Hello World!* response (single thread process).
Node version: v10.14.1
Laptop: MacBook Pro 2016, 2,7 GHz Intel Core i7, 16 GB 2133 MHz LPDDR3
```bash
wrk -t8 -c8 -d30s http://localhost:3000/hi
```
### String response ('Hello World!')
* **restana-turbo-http**: Requests/sec 57708.05
* **restana**: Requests/sec 46314.39
* **restana-cluster**: Requests/sec 70979.80
* fastify: Requests/sec 36873.05
* restify: Requests/sec 26388.94
* koa: Requests/sec 25686.12
* hapi: Requests/sec 20279.23
* express: Requests/sec 16812.15
### JSON response ({msg: 'Hello World!'})
* **restana-turbo-http**: Requests/sec 53544.21
* **restana**: Requests/sec 39363.91
* fastify: Requests/sec 33600.85
* restify: Requests/sec 29490.79
* koa: Requests/sec 23787.82
* hapi: Requests/sec 19404.48
* express: Requests/sec 15365.56
### 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
You can checkout `restana` performance index on the ***"Which is the fastest"*** project: https://github.com/the-benchmarker/web-frameworks#full-table-1
## Using this project? Let us know 🚀
https://goo.gl/forms/qlBwrf5raqfQwteH3
https://goo.gl/forms/qlBwrf5raqfQwteH3
## Breacking changes
### 3.x:
- Support for `turbo-http` library was dropped.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc