-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (22 loc) · 839 Bytes
/
index.js
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
26
27
28
29
const express = require('express');
const bodyParser = require('body-parser');
const { userRouter, loginRouter, categorieRouter, blogPostRouter } = require('./controllers');
const { inputError, domainError, serverError } = require('./controllers/errorsHandler');
const authentication = require('./tokenHandler/authentication');
const app = express();
app.use(express.json());
app.use(bodyParser.json());
app.use('/user', userRouter);
app.use('/login', loginRouter);
app.use(authentication);
app.use('/categories', categorieRouter);
app.use('/post', blogPostRouter);
/* Error Handlers */
app.use(inputError);
app.use(domainError);
app.use(serverError);
app.listen(3000, () => console.log('ouvindo porta 3000!'));
// não remova esse endpoint, e para o avaliador funcionar
app.get('/', (request, response) => {
response.send();
});