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

@barelyhuman/conrou

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barelyhuman/conrou - npm Package Compare versions

Comparing version 0.1.2-alpha.6 to 0.1.2-alpha.7

2

package.json
{
"name": "@barelyhuman/conrou",
"version": "0.1.2-alpha.6",
"version": "0.1.2-alpha.7",
"repository": "git@github.com:barelyhuman/conrou.git",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -46,5 +46,9 @@ # conrou

router.get('/me', 'UserController.me')
// or, if you created an alias
router.get('/me', 'user.me')
// or
router.get('/me', (req, res) => {
console.log('hello')
res.end()
})

@@ -58,4 +62,36 @@ // to get the route for a particular controller, you can use the

## Middleware
Each router interface that you use might have a different way of handling middleware and so
it's not really recommended to use `conrou`'s middleware utility for this.
Though, conrou does provide a way for you to add in middleware that mimic the execution order similar to
express.
```js
// Using `polka` as an example
const app = polka()
// Register the router as before
const router = createControllerBinder(app)
router.register(AuthController)
router.registerMiddleware('auth', (req, res, next) => {
req.currentUser = {
id: 1,
}
next()
})
router
.get('/user', (req, res) => {
console.log(req.currentUser) // 1
return res.end()
})
// tie the named middleware to this particular route
// this syntax / API was inspired by AdonisJS (https://github.com/adonisjs/)
.middleware(['auth'])
```
## LICENSE
[MIT](/LICENSE)
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