npm.io
0.2.0 • Published 6 years ago

next-route-to-express-route

Licence
Apache-2.0
Version
0.2.0
Deps
0
Size
48 kB
Vulns
0
Weekly
0

next-route-to-express-route

Converts Next.js routes to Express.js routes.

npm i next-route-to-express-route
const { fromNextToExpressRoute } = require('next-route-to-express-route')

console.log(fromNextToExpressRoute('/users/[id]/profile'))
// => '/users/:id/profile'

It works with catch-all routes too:

const { fromNextToExpressRoute } = require('next-route-to-express-route')

console.log(fromNextToExpressRoute('/users/[...]'))
// => '/users/*'

That's it! It's just a simple utility package

Author

Fran Mendez • Twitter

License

Apache 2.0

Keywords