Video 108: Express Middleware
This commit is contained in:
parent
d4dac9c676
commit
526fc9ebdd
@ -6,6 +6,18 @@ const taskRouter = require('./routers/task')
|
||||
const app = express()
|
||||
const port = process.env.PORT || 4200
|
||||
|
||||
// app.use((req, res, next) => {
|
||||
// if (req.method === 'GET') {
|
||||
// res.send('GET requests are disabled')
|
||||
// } else {
|
||||
// next()
|
||||
// }
|
||||
// })
|
||||
|
||||
app.use((req, res, next) => {
|
||||
res.status(503).send('Site is in maintenance mode').end()
|
||||
})
|
||||
|
||||
app.use(express.json())
|
||||
app.use(userRouter)
|
||||
app.use(taskRouter)
|
||||
|
Loading…
Reference in New Issue
Block a user