-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
36 lines (29 loc) · 1.07 KB
/
app.js
File metadata and controls
36 lines (29 loc) · 1.07 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
var express = require('express')
var app = express();
var router = express.Router()
var path = require('path');
var web = require('./routes/web');
var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true, limit: '100mb' }));
var exphbs = require('express-handlebars');
app.use(express.static(path.join(__dirname, 'public')));
app.engine('.html', exphbs({ defaultLayout: 'main', extname: '.html'}));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', '.html');
var $ = require('jquery')(require('jsdom-no-contextify').jsdom().parentWindow);
// Support for Cross-domain request with using jQuery
// See: http://garajeando.blogspot.jp/2012/06/avoiding-xmlhttprequest-problem-using.html
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
$.support.cors = true;
$.ajaxSettings.xhr = function () {
return new XMLHttpRequest;
}
app.use(web);
app.get('/', function(req, res) {
res.render('index');
})
app.listen(3000, function () {
console.log('Express listening at', 3000);
});
module.exports = app;