-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
73 lines (56 loc) · 1.65 KB
/
server.js
File metadata and controls
73 lines (56 loc) · 1.65 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
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
71
'use strict';
var express = require('express');
var http = require('http');
var path = require('path');
var async = require('async');
var hbs = require('express-hbs');
var baucis = require('baucis');
var faye = require('faye');
//var content = require('./data');
// start mongoose
//mongoose.connect('mongodb://localhost/sit');
//var db = mongoose.connection;
//db.on('error', console.error.bind(console, 'connection error:'));
//db.once('open', function callback () {
/* test schema */
// var testSchema = new mongoose.Schema({
// test: String
// });
//var Test = mongoose.model( 'test', testSchema );
/* set Baucis */
// baucis.rest({
// singular: 'test'
// });
var app = express();
app.configure(function(){
app.set('port', process.env.PORT || 9000);
// app.set('view engine', 'handlebars');
// app.set('views', __dirname + 'app/scripts/views');
});
// app.use('/api/v1', baucis());
// simple log
//app.use(function(req, res, next){
// console.log('%s %s', req.method, req.url);
// next();
// });
// mount static
app.use(express.static( path.join( __dirname, 'app') ));
app.use(express.static( path.join( __dirname, '../.tmp') ));
// app.get('/content', function(req, res){
//
// res.json(content.content);
// });
//
// app.get('/content/source', function(req, res){
//
// res.sendfile( path.join( __dirname, 'data.js' ) );
// });
// route index.html
app.get('/', function(req, res){
res.sendfile( path.join( __dirname, 'app/index.html' ) );
});
// start server
http.createServer(app).listen(app.get('port'), function(){
console.log('Express App started!');
});
//});