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 1.0.0 to 1.1.0

43

index.js

@@ -1,12 +0,11 @@

const http = require('http')
const methods = ['get', 'delete', 'patch', 'post', 'put', 'head', 'options']
const extensions = {
const exts = {
request: {},
response: require('./libs/response-extensions')
}
const URL = require('url')
const URL = require('fast-url-parser')
const reqHandler = require('./libs/middleware-chain')
module.exports = (options = {}) => {
const server = options.server || http.createServer()
const server = options.server || require('http').createServer()
server.on('request', (req, res) => {

@@ -57,4 +56,4 @@ app.handler(req, res)

handler: (req, res) => {
for (const method of Object.keys(extensions.response)) {
res[method] = extensions.response[method](req, res)
for (const method of Object.keys(exts.response)) {
res[method] = exts.response[method](req, res)
}

@@ -67,19 +66,18 @@ const url = URL.parse(req.url)

// calling middlewares
require('./libs/middleware-chain')(
[
...middlewares.slice(0),
{
context: {},
handler: (req, res, next) => {
const route = `[${req.method.toUpperCase()}]${req.path}`
res.on('response', () => {
next()
})
reqHandler([
...middlewares.slice(0),
{
context: {},
handler: (req, res, next) => {
const route = `[${req.method.toUpperCase()}]${req.path}`
res.on('response', () => {
next()
})
if (wayfarer(route, req, res) === 404) res.send(404)
}
if (wayfarer(route, req, res) === 404) res.send(404)
}
],
req,
res
}
],
req,
res
)()

@@ -103,2 +101,3 @@ },

}
methods.forEach((method) => {

@@ -105,0 +104,0 @@ app[method] = (path, handler, ctx) => app.route(method, path, handler, ctx)

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

@@ -36,3 +36,4 @@ "main": "index.js",

"dependencies": {
"wayfarer": "6.x.x"
"fast-url-parser": "^1.1.3",
"wayfarer": "^6.6.4"
},

@@ -42,7 +43,7 @@ "devDependencies": {

"mocha": "3.x.x",
"morgan": "1.x.x",
"morgan": "^1.9.0",
"standard": "^11.0.1",
"supertest": "3.x.x",
"winston": "2.x.x"
"winston": "^2.4.2"
}
}
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