@autotelic/dev-server-module
v0.1.0
Published
Local development http server infrastructures
Downloads
3
Readme
dev-server-module
This module gets you up and running fast with a local development server.
How to use
- in your project root install this module with
npm install @autotelic/dev-server-module
- create a file to import & use this module, e.g.
runDevServer.js
Here's an example of what your runDevServer.js
could look like:
import devServer from '@autotelic/dev-server-module';
import defaultDevRouter from '@autotelic/dev-server-module';
import mockFunction from '@autotelic/dev-server-module';
devServer.instantiateRouter(defaultDevRouter('/rates', mockFunction));
This exact example above will create a dev server with the default router at the /rates
route.
Instead of the mockFunction
you should import your function and pass it ot the defaultDevRouter
as the second argument.
If you want to create your own router and not use the provided defaultRouter, you can pass your router to
devServer.instantiateRouter(<YOUR_ROUTER>)
.
- to run the dev server locally, execute the command `node runDevServer.js` from within your project.