fix: нет зависимостей — чистый http без express
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
app.get('/', (_req, res) => res.send('Say OK'));
|
||||
app.get('/health', (_req, res) => res.json({ status: 'ok' }));
|
||||
|
||||
const http = require('http');
|
||||
const PORT = process.env.PORT || 3000;
|
||||
app.listen(PORT, () => console.log(`:${PORT}`));
|
||||
|
||||
http.createServer((req, res) => {
|
||||
if (req.url === '/health') {
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
res.end('{"status":"ok"}');
|
||||
} else {
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
res.end('Say OK');
|
||||
}
|
||||
}).listen(PORT, () => console.log(':' + PORT));
|
||||
|
||||
Reference in New Issue
Block a user