Commit 73ab898d1a51bfedf79cf804c78461dcec622691
1 parent
9c709584c2
Exists in
master
and in
1 other branch
Perbaikan morgan.
Showing 2 changed files with 20 additions and 5 deletions Side-by-side Diff
lib/apiserver/index.js
... | ... | @@ -9,12 +9,12 @@ const handlerOnReceived = require('./handler/on-received'); |
9 | 9 | |
10 | 10 | const app = express(); |
11 | 11 | |
12 | -// const accessLogStream = rfs('access_log', { | |
13 | -// interval: '1d', | |
14 | -// path: './logs', | |
15 | -// }); | |
12 | +const accessLogStream = rfs.createStream('access_log', { | |
13 | + interval: '1d', | |
14 | + path: './logs', | |
15 | +}); | |
16 | 16 | |
17 | -// app.use(morgan, 'combined', { stream: accessLogStream }); | |
17 | +app.use(morgan('combined', { stream: accessLogStream })); | |
18 | 18 | |
19 | 19 | app.get('/ping', (req, res) => { res.end('PONG'); }); |
20 | 20 | app.get('/service', handlerOnReceived); |
lib/webadmin/index.js
... | ... | @@ -0,0 +1,15 @@ |
1 | +const express = require('express'); | |
2 | + | |
3 | +const config = require('komodo-sdk/config'); | |
4 | +const logger = require('komodo-sdk/logger'); | |
5 | + | |
6 | + | |
7 | +const app = express(); | |
8 | + | |
9 | +const listenPort = (config.webadmin && config.webadmin.port) || 21923; | |
10 | +app.listen(listenPort, () => { | |
11 | + logger.info(`WEBADMIN listen on port ${listenPort}`); | |
12 | +}).on('error', (err) => { | |
13 | + logger.warn(`WEBADMIN can not start / listen on port ${listenPort}`, { err: err.message }); | |
14 | + process.exit(); | |
15 | +}); |