-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
20 lines (18 loc) · 733 Bytes
/
app.js
File metadata and controls
20 lines (18 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const cors = require('cors');
const express = require('express');
const usersRouter = require('./src/routers/users.route');
const postsRouter = require('./src/routers/posts.route');
const likesRouter = require('./src/routers/likes.route');
const commentsRouter = require('./src/routers/comments.route');
const errorHandler = require('./src/middlewares/error_handler.middleware');
const userAuthentication = require('./src/middlewares/user_auth.middleware');
const app = express();
app.use(cors());
app.use(express.json());
app.use('/users', usersRouter);
app.use(userAuthentication);
app.use('/posts', postsRouter);
app.use('/likes', likesRouter);
app.use('/comments', commentsRouter);
app.use(errorHandler);
module.exports = app;