This repository has been archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
51 lines (44 loc) · 1.58 KB
/
app.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
/**
* Module dependencies.
*/
var express = require('express'),
favicon = require('static-favicon'),
logger = require('morgan'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
methodOverride = require('method-override'),
session = require('express-session'),
errorHandler = require('errorhandler'),
routes = require('./routes'),
http = require('http'),
path = require('path'),
prismic = require('./prismic-helpers');
var app = express();
// Inject interesting libs to use in templates
app.locals.moment = require('moment');
app.locals._ = require('lodash');
// all environments
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(favicon());
app.use(logger('dev'));
app.use(bodyParser());
app.use(methodOverride());
app.use(cookieParser('1234'));
app.use(session({secret: '1234', saveUninitialized: true, resave: true}));
app.use(express.static(path.join(__dirname, 'public')));
app.use(errorHandler());
// Routes
app.route('/').get(routes.index);
app.route('/author/:id/:slug').get(routes.author);
app.route('/search').get(routes.search);
app.route('/category/:uid').get(routes.category);
app.route('/tag/:tag').get(routes.thetag);
app.route('/archive/:year').get(routes.archive);
app.route('/archive/:year/:month').get(routes.archive);
app.route('/archive/:year/:month/:day').get(routes.archive);
app.route('/preview').get(routes.preview);
app.route('/feed').get(routes.feed);
app.route('/:year/:month/:day/:uid').get(routes.post);
app.route('/:uid').get(routes.page);
module.exports = app;