@bayerjs/mount
TypeScript icon, indicating that this package has built-in type declarations

0.3.0-alpha.1 • Public • Published

@bayerjs/mount

Mount Bayer.js middlewares into subdirectories.

Usage

import Bayer from "@bayerjs/core";
import mount from "@bayerjs/mount";
import staticFiles from "@bayerjs/static";
const server = new Bayer();
server.use(mount("/static", staticFiles(STATIC_DIR)), 1); // Here we use the static middleware as an example

server.listen(3000);

In the snippet above, the server will respond to requests with a 404 error (the default behavior), but will delegate requests made to /static to the static middleware.

Mounting Bayer applications

Ther Bayer server class exposes a middleware() function that returns a server middleware; you can use this to mount sub-application into subdirectories, and essentially turn them into modules.

Package Sidebar

Install

npm i @bayerjs/mount

Weekly Downloads

3

Version

0.3.0-alpha.1

License

MIT

Unpacked Size

7.49 kB

Total Files

7

Last publish

Collaborators

  • solarliner