-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (20 loc) · 774 Bytes
/
app.js
File metadata and controls
25 lines (20 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import express from 'express';
import cors from 'cors';
import 'dotenv/config';
import errorHandler from './middlewares/errorHandler.js';
import groupController from './controllers/groupController.js';
import postController from './controllers/postController.js';
import imageController from './controllers/imageController.js';
import commentController from './controllers/commentController.js';
const app = express();
app.use(cors());
app.use(express.json());
app.use('/api/groups', groupController);
app.use('/api/posts', postController);
app.use('/api/image', imageController);
app.use('/api/comments', commentController);
app.use(errorHandler);
const port = process.env.PORT ?? 3000;
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});