-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
30 lines (25 loc) · 806 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
30
const express = require('express');
const dotEnv = require('dotenv');
const cors = require('cors');
// external imports
const dbConnection = require('./db/connection');
const authRouter = require('./routes/auth');
const userRouter = require("./routes/user");
const movieRouter = require("./routes/movie");
const listRouter = require("./routes/list");
const app = express();
dotEnv.config();
app.use(express.json());
app.use(cors());
// database connection
dbConnection();
app.use('/api/auth', authRouter);
app.use('/api/users', userRouter);
app.use('/api/movies', movieRouter);
app.use('/api/lists', listRouter);
app.use('/', (req, res) => {
res.send('working');
});
app.listen(process.env.PORT || 5000, (req, res) => {
console.log(`Server is running on port ` + process.env.PORT || 5000);
});