Express Routing
Sat Nov 28 2020 17:42:31 GMT+0000 (UTC)
Posted by
@narro
#typescript
//* Root Handler
app.get("/", (req, res) =>
res.sendFile(path.join(__dirname + "/public/index.html"))
);
app.get('api/v1', (req,res) => res.json())
// Set static folder
app.use(express.static(path.join(__dirname, 'public')));
app.use('/api/v1', require('./routes/api/v1'))
app.listen(port, () => {
console.log(`Server at: http://localhost:${port}`);
});
content_copy Copy
NodeJS Express Routing
Comments