forked from corshidan/globalScopeBE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
30 lines (26 loc) · 865 Bytes
/
app.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
30
const express = require('express');
const app = express();
const cors = require('cors');
const port = process.env.PORT || 5000;
const bootcamperRouter = require('./routes/bootcampers');
const reflectionRouter = require('./routes/reflections');
const topicsRouter = require('./routes/topics');
const loginRouter = require('./routes/login');
const quoteRouter = require('./routes/quotes');
// Middlewares
app.use(cors({ origin: '*' }));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
//Routers
app.use('/bootcampers', bootcamperRouter);
app.use('/reflections', reflectionRouter);
app.use('/topics', topicsRouter);
app.use('/login', loginRouter);
app.use('/quote', quoteRouter);
app.get('/', (req, res) => {
res.json({
success: true,
payload: 'it worked',
});
});
app.listen(port, () => console.log('listening on port ' + port));