@web-tk/bebe

0.0.4-beta • Public • Published

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

  1. there must be a route file
  2. route represents /
  3. inside you can define a middleware.js, index.js, and error.js file with are mounted on a given router in that order (this can be done at any path)
  4. middleware will always be mounted before handlers
  5. 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
  1. You can also define slugs and catch-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 used req.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

Readme

Keywords

none

Package Sidebar

Install

npm i @web-tk/bebe

Weekly Downloads

0

Version

0.0.4-beta

License

ISC

Unpacked Size

14.3 kB

Total Files

8

Last publish

Collaborators

  • webtoolkit_npm