-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
52 lines (41 loc) · 1.38 KB
/
index.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
var cool = require('cool-ascii-faces');
var express = require('express');
var bodyParser = require('body-parser');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var url = require('url');
var app = express();
var index = require('./routes/index');
var projects = require('./routes/projects');
app.set('port', (process.env.PORT || 5000));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
/** Application parts use declaration **/
app.use('/', index);
app.use('/projects', projects);
app.use('/clients', projects);
//app.use('/workers', workers);
app.use(express.static(__dirname + '/stylesheets'));
/** Common error handle **/
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
app.use(express.static(__dirname + '/public'));
// views is directory for all template files
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.get('/', function(request, response) {
response.render('pages/index')
});
module.exports = app;
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});