@ptenn/webserver
v1.3.0
Published
## Installation
Readme
webserver
Installation
Run yarn add @ptenn/webserver or npm add @ptenn/webserver.
Usage
To set up the server, use the following as a guideline:
import serviceRoutes from './serviceRoutes';
const app = new Server({
...config,
environment: 'development',
});
app.init((server: Server, express: Express) => {
// load custom middleware or setup extra configuration for service
});
app.loadRoutes(serviceRoutes);
return Promise.resolve()
.then(() => app.listenAndServe());To set up routes to add using the loadRoutes() function:
export default (server: Server, express: Express) => {
express.get('/data', server.routeHandler((req: Request) => {
return {
json: 'information',
};
}));
};Publishing
Publish by running npm publish
