Skip to content

Commit

Permalink
fix close bug
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Dec 21, 2021
1 parent 5cf111d commit 7c02ac4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
const { createServer } = require("http")
const next = require("next")
const path = require("path")

module.exports = async ({ port }) => {
const app = next({
const customServerConf = {
dev: false,
dir: path.resolve(__dirname),
quiet: false,
})
}
console.log({ customServerConf })
const app = next(customServerConf)
const handleRequest = app.getRequestHandler()
await app.prepare()
const server = createServer((req, res) => {
return handleRequest(req, res)
})
console.log("nextjs-health-endpoint-module listening on", port)
server.listen(port)
return { close: server.close() }
return { close: () => server.close() }
}

if (!module.parent) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@seamapi/nextjs-health-endpoint-module",
"version": "1.0.1",
"version": "1.0.3",
"main": "index.js",
"repository": {
"url": "https://github.com/hello-seam/nextjs-health-endpoint-module"
Expand Down

0 comments on commit 7c02ac4

Please sign in to comment.