-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
30 lines (25 loc) · 762 Bytes
/
server.js
File metadata and controls
30 lines (25 loc) · 762 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
var express = require('express');
var expressLayouts = require('express-ejs-layouts');
var mongojs = require("mongojs");
var databaseUrl = "mydb";
var collections = ["users", "reports"]
var db = mongojs.connect(databaseUrl, collections);
app = express.createServer();
app.configure(function() {
app.use(express.bodyParser());
app.use(app.router);
app.use("/public", express.static(__dirname + '/public'));
});
app.set('view engine', 'ejs');
app.use(expressLayouts);
app.use(app.router);
app.get('/', function(request, response){
response.render('index.ejs');
/* response.render('index.ejs', {}, function(err, str) {
response.render('layout.ejs', {
body: str
});
});*/
});
console.log("Listening on port 8080");
app.listen(8080);