UNPKG

siegel

Version:

Web application development ecosystem

25 lines (24 loc) 785 B
import httpServer from './http.js'; import http2Server from './http2/index.js'; const server = { async run(params) { const { http2, host, port } = params.config.server; const server = http2 ? await http2Server(params) : await httpServer(params); server.on('error', console.error); const serverInstance = server.listen(port, host, err => { err ? console.error(err) : console.info('Starting server on %s:%s.', host, port); }); // process.on('SIGTERM', () => { // serverInstance.close() // }) // process.on('SIGINT', () => { // serverInstance.close() // }) return serverInstance; } }; export default server;