alp-listen
Listen function, using config and logger for alp server
Install
npm install --save alp-listen
Usage
import Koa from 'koa';
import config from 'alp-node-config';
import errors from 'alp-errors';
import logger from 'alp-logger';
import listen from 'alp-listen';
const app = new Koa();
config(new URL('./config', import.meta.url), { packageConfig })(app);
logger(app);
app.use(errors);
listen(new URL('../cert', import.meta.url))(app).then((server) => {
console.log('Listening !');
});
config:
-
socketPath
ORport
(+hostname
) -
tls
: boolean
If tls
is true, the files server.key
and server.crt
will be loaded from the path given in the first param