bebe
To start:
npm install --save @web-tk/bebe
bebe dev # Makes a dev server
bebe export # Exports compiled express server to .bebe/
How to Use
- there must be a
route
file -
route
represents/
- inside you can define a
middleware.js
,index.js
, anderror.js
file with are mounted on a given router in that order (this can be done at any path) - middleware will always be mounted before handlers
- inside routes (or any directory in routes) you can define a path by creating a directory
- ex. if you have
routes/foo/index.js
, a route for/foo
will be created
- You can also define
slugs
andcatch-all
routes.
- ex. if you have
routes/[slug]/index.js
, a route for/:slug
will be created - ex. if you have
routes/[...slug]/index.js
, a route for/*
will be created. You can find out the caught path by looking up the path usedreq.slug
Note slugs and catch alls can use any name.
Current Limitations:
- only supports @babel/preset-env syntax
- relationships for complex routing have not been ironed out all the way (should a double slug route before a catch all ?)
Ideas / TODO:
- route level error handling
- async route error handling
- async middleware error handling