Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/adapter-node/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import process from 'node:process';
import { handler } from 'HANDLER';
import { env, timeout_env } from 'ENV';
import polka from 'polka';
import { unlink } from 'node:fs/promises';

export const path = env('SOCKET_PATH', false);
export const host = env('HOST', '0.0.0.0');
Expand Down Expand Up @@ -56,6 +57,14 @@ if (socket_activation) {
console.log(`Listening on file descriptor ${SD_LISTEN_FDS_START}`);
});
} else {
if (path) {
try {
await unlink(path);
} catch (err) {
//ignore missing file errors
if (err.code !== 'ENOENT') throw err;
}
}
server.listen({ path, host, port }, () => {
console.log(`Listening on ${path || `http://${host}:${port}`}`);
});
Expand Down
Loading