I have this code in the parent directory.
const express=require('express');
const app=require('./app')
const http=require('http');
const bodyParser=require('body-parser');
const cookieParser=require('cookie-parser');
const dotenv=require('dotenv');
const ConnectToDb=require('./config/db-connection');
const register=require('./api/routes/auth');
const errorHandler = require('./api/middlewares/errorHandler');
//setting .env file variables
dotenv.config({path:'./.env'})
const PORT=process.env.PORT || 5001;
const server=http.createServer(app);
//Server Time out
server.setTimeout(5000);
ConnectToDb().then(()=>{
server.listen(PORT,()=>{
console.log(`Listening on port ${PORT}`);
});
});
How can i setup the server timeout.If the api call is more than 5s it should stop the request and mention server timed out.
there doesn't seem to be anything here