I want to load 'get-all' page when I am in a main page. The code is below:
const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => { console.log(`express server is listening on port ${PORT}`) });
app.get('/', (req: any, res: any) => {
res.redirect('/get-all');
});
app.post('/create', (req: any, res: any) => {
});
app.post('/get-all', (req: any, res: any) => {
res.send('get all') // error: get all not found
});
app.post('/delete', (req: any, res: any) => {
});
app.post('/update', (req: any, res: any) => {
});
The error is: Cannot GET /get-all (I tried to run it via Postman). I didn't find clear answer in the documentation. Thanks!