New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autoroute-express-promise

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autoroute-express-promise - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

package.json
{
"name": "autoroute-express-promise",
"version": "0.2.1",
"version": "0.2.2",
"description": "autoroute for use with promises",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -81,5 +81,27 @@ # Auto-route Express Promise

Example with two routes:
Cleaner nested route syntax (version 0.2):
```js
var routes = {
'/pets': {
_methods: [
[ method.post, (req: Request) => getPet(req.body) ] ]
':id': [
[ method.get, (req: Request) => getPet(req.params[ID]) ],
[ method.delete, (req: Request) => petDied(req.params[ID]) ] ]
},
'/cats': {
':id': [
[ method.get, (req: Request) => getCat(req.params[ID]) ] ]
'/hamsters': { // Overrides cats because of the forward slash at beginning
'/fish': [ // Overrides hamsters (hamsters bite)
[ method.get, (req: Request) => getFish(req.params[ID])] ]
}
}
}
```
Example with two routes (this is the old way, you can still do it this way.):
```js
import {method} from 'autoroute-express-promise'

@@ -106,19 +128,2 @@ import {getPet, newPet, petDied} = require('../../pets')

```
Cleaner nested route syntax (version 0.2+):
```js
var routes = {
'/pets': {
methods: [
[ method.post, (req: Request) => getPet(req.body) ] ]
':id': {
methods: [
[ method.get, (req: Request) => getPet(req.params[ID]) ],
[ method.delete, (req: Request) => petDied(req.params[ID]) ] ]
}
}
}
```
## API

@@ -125,0 +130,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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