-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
28 lines (18 loc) · 867 Bytes
/
server.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
const express = require('express')
const connectDB = require('./config/dbconnect');
const app = express();
//Database connection method call
connectDB();
// Init Middleware (body-parser)
app.use(express.json({extended: false}));
//Making 'UserPostImages' folder public so that we don't have to cretae any extra route for postimage access
app.use('/UserPostImages', express.static('UserPostImages'));
app.get('/', (req, res)=> res.send('API Running'));
//Routes defined
app.use('/api/users', require('./routes/api/users'));
app.use('/api/userpost', require('./routes/api/userpost'));
app.use('/api/authentication', require('./routes/api/authentication'));
app.use('/api/userprofile', require('./routes/api/userprofile'));
//routes.initialize(app);
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log('Server satrted on port : '+ PORT));