Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const PORT = 5000;
- const app = express();
- // Rules for routes comming up next only for the /table path(route) // Middleware
- app.use('/table', (req, res, next) => {
- let shirt = req.shirt;
- let shoes = req.shoes;
- if (shirt && shoes) {
- next();
- }
- console.log(`Request: ${req} Response: ${res}`);
- })
- // Get retrive information based on specific acction
- app.get('/', (req, res) => {
- res.send('Hello World');
- })
- app.get('/table/:amount', (req, res, next) => {
- let party = req.params.amount;
- res.end(`We're searching for your table for ${party}!`)
- })
- app.listen(PORT, () => {
- console.log(`We're live on PORT: ${PORT}`);
- })
Add Comment
Please, Sign In to add comment