2022-02-04 09:33:03 +00:00
|
|
|
export function start(http, port, ctx) {
|
2022-01-28 11:47:55 +00:00
|
|
|
const server = http.createServer(function (req, res) {
|
|
|
|
res.writeHead(200);
|
|
|
|
res.end(JSON.stringify({ version: 'exampleindex' }))
|
|
|
|
})
|
|
|
|
|
|
|
|
return new Promise(function(res, rej) {
|
|
|
|
server.listen(port || 4000, '0.0.0.0', function(err) {
|
|
|
|
if (err) {
|
|
|
|
return rej(err)
|
|
|
|
}
|
2022-02-04 09:33:03 +00:00
|
|
|
ctx.log.event.info(`Server is listening on ${port} serving exampleindex`)
|
|
|
|
ctx.log.info(`Server is listening on ${port} serving exampleindex`)
|
2022-01-28 11:47:55 +00:00
|
|
|
res()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|