-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (19 loc) · 696 Bytes
/
index.js
File metadata and controls
28 lines (19 loc) · 696 Bytes
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
// Express code to egt express server instace up and call the AIP code
const express = require('express');
const path = require('path');
const connectDB = require('./config/db.js');
const app = express();
//Connect to MongoDB:
connectDB();
app.use(express.json({extended: false}));
// Defining routes:
//Route to Send path to HTML file
app.use('/index', function(req,res){
res.sendFile(path.join(__dirname+'/HTML/index.html'));
});
//Route for /"Short URL Code"
app.use('/', require('./routes/index'));
//Route for Longer to shorter conversion
app.use('/api/url', require('./routes/url'));
const PORT=5000;
app.listen(PORT, () => console.log(`Express Server has started on ${PORT}`));