-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapp.js
More file actions
34 lines (25 loc) · 912 Bytes
/
app.js
File metadata and controls
34 lines (25 loc) · 912 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
29
30
31
32
33
34
const express= require('express');
const bodyParser= require('body-parser');
const mongoose= require('mongoose');
const User = require('./models/user');
const app= express();
const PORT = process.env_PORT || 3000;
const IP = process.env_IP || 'localhost';
const MONGODBPORT= process.env.MONGODBPORT || 27017;
//require ROUTES
const pwRecover = require("./routes/pwrecover");
const seedDB= require('./seed'); //remove everything from DB and seed it with new Data
mongoose.connect(`mongodb://localhost:${MONGODBPORT}/pwRecoverTest`);
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
seedDB(); // call the seeding function
app.use(function(req, res, next){
res.locals.error= "";
res.locals.success= "";
next();
});
app.use(pwRecover)
app.listen(PORT, IP, () => {
console.log(`node-password-recovery Server is listening @${PORT} on ${IP}`);
})