-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·30 lines (24 loc) · 1.22 KB
/
server.js
File metadata and controls
executable file
·30 lines (24 loc) · 1.22 KB
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
#!/usr/bin/env node
var express = require('express');
var app = express();
var mongoose = require('mongoose')
, argv = require('./options')
// configuration ===========================================
// config files
//var db = require('./config/db');
var port = process.env.PORT || 8080; // set our port
// mongoose.connect(db.url); // connect to our mongoDB database (commented out after you enter in your own credentials)
app.configure(function() {
app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
app.use(express.logger('dev')); // log every request to the console
app.use(express.bodyParser()); // pull information from html in POST
app.use(express.methodOverride()); // simulate DELETE and PUT
});
// routes ==================================================
require('./app/routes')(app); // pass our application into our routes
// start app ===============================================
var server = app.listen(3000, function(){
console.log('listening on ' + server.address().port)
});
console.log('Magic happens on port ' + port); // shoutout to the user
exports = module.exports = app; // expose app