-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
22 lines (17 loc) · 600 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
const express = require('express');
const app = express();
require('dotenv').config();
// Mongo Connection
const connection = require('./config/db.config');
connection.once('open', () => console.log('DB Connected'));
connection.on('error', () => console.log('Error'));
app.use(
express.json({
extended: false,
})
); //parse data to JSON
app.use('/', require('./routes/redirect'));
app.use('/api/url', require('./routes/url'));
app.use('/api/list', require('./routes/list'));
const PORT = process.env.PORT || 5050;
app.listen(PORT, console.log(`server started, listening PORT ${PORT}`));