-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (25 loc) · 832 Bytes
/
index.js
File metadata and controls
27 lines (25 loc) · 832 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
const express=require("express");
const mongoose=require("mongoose");
const bodyParser=require("body-parser");
const app=express();
// connecting to routes
const userRoute=require("./routes/basicroute");
// required for accecing this from different platforms VVIP
const cors = require("cors");
//Connecting to database
mongoose.Promise = global.Promise;
// place your db here
mongoose.connect("mongodb://admin:123456@ds263137.mlab.com:63137/basicpasswords", { 'useMongoClient': true })
.then(() => console.log("Connected to passwordbasic..."))
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(cors());
app.use("/",userRoute);
app.listen(3000,function(err){
if(err){
console.log("Error occured ");
}
else{
console.log("basic password running ");
}
});