Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const ejs = require('ejs');
- const port = 5000;
- var app = express();
- app.set('view engine', 'ejs');
- app.set('views', __dirname+'/views');
- app.get('/', (req,res)=> {
- res.render('index');
- })
- app.get('/slowService/:time', (req,res)=> {
- setTimeout(sendResponse, 3000, res,req.params.time);
- })
- app.listen(port, () => {
- console.log(`Chatroom listening on port ${port}`);
- })
- function sendResponse(res,time) {
- res.send("slow response " + time);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement