mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2025-06-10 21:37:13 +00:00
Add health check endpoint
This commit is contained in:
parent
f278c7cf8e
commit
757ec4358a
10
src/index.ts
10
src/index.ts
@ -92,6 +92,16 @@ validateEnvironmentVariables();
|
||||
createServer((req: IncomingMessage, res: ServerResponse) => {
|
||||
const startTimestamp = Date.now()
|
||||
|
||||
// health endpoint. this endpoint is special because it doesn't print traces
|
||||
if (req.url == '/health') {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'application/json'
|
||||
})
|
||||
res.write(JSON.stringify({"status": "ok"}))
|
||||
res.end()
|
||||
return;
|
||||
}
|
||||
|
||||
// count the request for the log prefix
|
||||
log.incRequests()
|
||||
log.info(`Incoming request: ${req.method} ${req.url}`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user