-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
30 lines (24 loc) · 841 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 cors = require('cors');
const app = express();
const port = process.env.PORT || 8000;
const morgan = require('morgan');
const eventRoutes = require('./src/routes/events.routes');
const logRoutes = require('./src/routes/logs.routes');
const tagRouter = require('./src/routes/tags.routes');
const authRouter = require('./src/routes/auth.routes');
const verifyJWT = require('./src/middlewares/verifyJwt');
app.use(cors());
app.use(morgan('tiny'));
app.use(express.json());
// route for logs
app.use('/user', authRouter);
app.use('/log', verifyJWT, logRoutes);
app.use('/event', verifyJWT, eventRoutes);
app.use('/tag', verifyJWT, tagRouter);
app.get('/', async (req, res) => {
res.status(200).json({ msg: 'Hello' });
});
app.listen(port, () => {
console.log(`listening on port ${port}`);
});