next-route-to-express-route

0.2.0 • Public • Published

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

Package Sidebar

Install

npm i next-route-to-express-route

Weekly Downloads

0

Version

0.2.0

License

Apache-2.0

Unpacked Size

49.7 kB

Total Files

18

Last publish

Collaborators

  • fmvilas