diff --git a/server/src/index.js b/server/src/index.js new file mode 100644 index 0000000..751e172 --- /dev/null +++ b/server/src/index.js @@ -0,0 +1,20 @@ +import express from 'express'; +import cors from 'cors'; +import bodyParser from 'body-parser'; +import { router } from './router'; +import { errorHandler } from './middlewares/errorHandler'; +import { notFoundHandler } from './middlewares/notFoundHandler'; + +const app = express(); + +app.use(cors()); +app.use(bodyParser.json()); +app.use('/api', router); +app.use(errorHandler); +app.use(notFoundHandler); + +const PORT = process.env.PORT || 5000; + +app.listen(PORT, () => { + console.log(`Server is running on port ${PORT}`); +});