Rename directory from email-server-worker to email-worker for clarity and brevity. Update all references in CLAUDE.md documentation.
29 lines
594 B
TypeScript
29 lines
594 B
TypeScript
import { createLogger } from "./lib/logger";
|
|
|
|
import http, { IncomingMessage } from "http";
|
|
const logger = createLogger("server:healthcheck");
|
|
|
|
const options = {
|
|
host: "localhost",
|
|
port: "3000",
|
|
timeout: 2000,
|
|
path: '/healthcheck/'
|
|
};
|
|
|
|
const request = http.request(options, (res:IncomingMessage) => {
|
|
|
|
logger(`Healthcheck: STATUS ${res.statusCode}`);
|
|
|
|
if (res.statusCode == 200) {
|
|
process.exit(0);
|
|
} else {
|
|
process.exit(1);
|
|
}
|
|
});
|
|
|
|
request.on("error", function (err:any) {
|
|
logger("Healthcheck: ERROR");
|
|
process.exit(1);
|
|
});
|
|
|
|
request.end(); |