transfer
This commit is contained in:
5
attendancetracker/API/DB.js
Normal file
5
attendancetracker/API/DB.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// DB.js
|
||||
|
||||
module.exports = {
|
||||
DB: 'mongodb://localhost:27017/mevncrud'
|
||||
}
|
||||
0
attendancetracker/API/post.model.js
Normal file
0
attendancetracker/API/post.model.js
Normal file
0
attendancetracker/API/post.route.js
Normal file
0
attendancetracker/API/post.route.js
Normal file
21
attendancetracker/API/server.js
Normal file
21
attendancetracker/API/server.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const bodyParser = require('body-parser');
|
||||
const PORT = 4000;
|
||||
const cors = require('cors');
|
||||
const mongoose = require('mongoose');
|
||||
const config = require('./DB.js');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.connect(config.DB, { useNewUrlParser: true }).then(
|
||||
() => {console.log('Database is connected') },
|
||||
err => { console.log('Can not connect to the database'+ err)}
|
||||
);
|
||||
|
||||
app.use(cors());
|
||||
app.use(bodyParser.urlencoded({extended: true}));
|
||||
app.use(bodyParser.json());
|
||||
|
||||
app.listen(PORT, function(){
|
||||
console.log('Server is running on Port:',PORT);
|
||||
});
|
||||
Reference in New Issue
Block a user