const express = require('express');
const http = require('http');
const cors = require('cors');
const app = express();
app.use(cors());
app.use(express.json()); // json body parsing
const todoRouter = express.Router();
todoRouter
.route('/')
.get(getDatabaseRoute)
.post(express.json(), postOperationsRoute);
app.use('/todos', todoRouter);
const port = process.env.PORT || 3000;
const httpServer = http.createServer(app);
httpServer.listen(port, () => {
console.log(`Express ready at http://localhost:${port}`)
});
res.type('application/json');
res.status(403);
res.send(content);