Skip to content

Commit

Permalink
Create index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored May 9, 2024
1 parent 09e1366 commit 65c42c6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions server/src/index.js
Original file line number Diff line number Diff line change
@@ -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}`);
});

0 comments on commit 65c42c6

Please sign in to comment.