Jonatan Nilsson
9a07149c86
Some checks failed
continuous-integration/appveyor/branch AppVeyor build failed
service-core: Update to version 3
22 lines
No EOL
687 B
JavaScript
22 lines
No EOL
687 B
JavaScript
import path from 'path'
|
|
import { readFileSync } from 'fs'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
export function run(http, orgPort, ctx) {
|
|
let packagePath = ctx.util.getPathFromRoot('./package.json')
|
|
let packageInfo = JSON.parse(readFileSync(packagePath))
|
|
|
|
const server = http.createServer(function (req, res) {
|
|
res.writeHead(200);
|
|
res.write(JSON.stringify(packageInfo, null, ' '))
|
|
res.end()
|
|
})
|
|
|
|
let port = orgPort || 4000
|
|
|
|
return server.listenAsync(port, '0.0.0.0')
|
|
.then(function() {
|
|
ctx.log.event.info(`Server is listening on ${port} serving package ${packagePath}`)
|
|
ctx.log.info(`Server is listening on ${port} serving package ${packagePath}`)
|
|
})
|
|
} |