app.js

Ghost main app file

/*global require */ (function () { "use strict";

Module dependencies.

var express = require('express'), fs = require('fs'), routes = require('./routes'), flash = require('connect-flash'), Ghost = require('./core/ghost'), I18n = require('./core/lang/i18n'), helpers = require('./core/frontend/helpers'), auth,

Variables

/** * Create new Ghost object * @type {Ghost} */ ghost = new Ghost(); ghost.app().configure('development', function () { ghost.app().use(express.favicon(__dirname + '/content/images/favicon.ico')); ghost.app().use(express.errorHandler()); ghost.app().use(I18n.load(ghost)); ghost.app().use(express.bodyParser()); ghost.app().use(express.cookieParser('try-ghost')); ghost.app().use(express.session({ cookie: { maxAge: 60000 }})); ghost.app().use(flash()); ghost.app().use(ghost.initTheme(ghost.app())); }); /** * Setup login details * p.s. love it. * * @type {*} */ auth = express.basicAuth('ghostadmin', 'Wh0YouGonnaCall?'); helpers.loadCoreHelpers(ghost); /** * @todo dynamic routing, homepage generator, filters ETC ETC */ ghost.app().post('/ghost/articles/create', auth, routes.ghost.articles.create); ghost.app().post('/ghost/articles/edit', auth, routes.ghost.articles.edit); ghost.app().get('/ghost/articles', auth, routes.ghost.articles.index); ghost.app().get('/ghost/editor/:id', auth, routes.ghost.editor); ghost.app().get('/ghost/editor', auth, routes.ghost.editor); ghost.app().get('/ghost/blog', auth, routes.ghost.blog); ghost.app().get('/ghost/settings', auth, routes.ghost.settings); ghost.app().get('/ghost/debug', auth, routes.ghost.debug.index); ghost.app().get('/ghost/debug/db/delete/', auth, routes.ghost.debug.dbdelete); ghost.app().get('/ghost/debug/db/populate/', auth, routes.ghost.debug.dbpopulate); ghost.app().get('/ghost', auth, routes.ghost.index); ghost.app().get('/:slug', routes.single); ghost.app().get('/', routes.homepage); ghost.app().listen(3333, function () { console.log("Express server listening on port " + 3333); console.log('process: ', process.env); }); }());