import express from 'express' import bodyParser from 'body-parser' import cohort from './cohort.js' import cohorts from './cohorts.js' import posts from './posts.js' import source from './source.js' const app = express() app.use((req, res, next) => { console.error(req.path) next() }) const api = express.Router() api.use(bodyParser.json()) app.use('/api', api) api.use('/cohort', cohort) api.use('/cohorts', cohorts) api.use('/posts', posts) api.use('/source', source) // app.use((req, res, next) => { // console.error('404!') // return res.status(404).json(err) // next() // }) app.use((err, req, res, next) => { console.error('sono asodifaosdijf'); console.error(err.stack); // return res.status(500).json({error: 'an error occurred'}); }) import './chew' export default app