-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
70 lines (60 loc) · 1.71 KB
/
app.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
var express = require('express');
var app = express();
var mongoose = require('mongoose');
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost/Music',{ useNewUrlParser: true })
.then(() => console.log('connection succesful'))
.catch((err) => console.error(err));
// view engine setup
app.set('view engine', 'ejs');
app.use(express.static('assets'));
var bodyParser = require('body-parser');
var session = require('express-session');
/* var User = require('./model/User');
var User1 = new User({
userId: "1",
password: "password123",
firstName: "Chirag",
lastName: "Jin",
email: "cjain4@uncc.edu",
address1: "9543 University Terrace Dr",
address2: "Apt K",
city: "Charlotte",
state: "North Carolina",
zipCode: 28262,
country: "United States"
});
User1.save(function (err, book) {
if (err) return console.error(err);
console.log(book.userId + " saved to bookstore collection.");
});
User.find({}).exec(function (err, users) {
if (err) {
console.log("Error:", err);
}
else {
console.log(users);
return users;
}
}); */
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: false
}));
app.use(session({
secret: 'Norms Music',
resave: true,
saveUninitialized: true
}));
// routes defining
var catalogController = require('./controller/catalogController');
var ProfileController = require('./controller/ProfileController');
app.use('/', ProfileController.router);
app.use('/', catalogController);
app.listen(8000,function(){
console.log('app started');
console.log('listening on port 8000');
console.log('Exit Process 0');
process.exit(1);
console.log('Exit Process');
});