fx87
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

fx87

Start a dev file server programmatically.

Examples

Start a file server on current directory:

const { serve } = require('fx87');

// `serve` also returns an instance of http.Server object.
serve({ path: './', port: 8080 });

Start a file server and intercept all .js file requests:

const { serve, Route } = require('fx87');

serve({
  path: './',
  port: 8080,
  routes: [
    new Route('/*.js', (req, res) => {
      res.writeHead(200, { 'Content-Type': 'text/plain' });
      res.end('Intercepted \n');
    }),
  ],
});

Readme

Keywords

Package Sidebar

Install

npm i fx87

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

7.15 kB

Total Files

8

Last publish

Collaborators

  • mgenware