-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.coffee
35 lines (29 loc) · 1004 Bytes
/
index.coffee
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
config = require('./config/config.json').production
express = require('express')
bodyParser = require('body-parser')
methodOverride = require('method-override')
exphbs = require('express-handlebars')
db = require('./models')
Router = require('./router')
Cron = require('./helpers/cron')
app = express()
app.use(express.static(__dirname + '/public'))
app.use(bodyParser.urlencoded({extended: false})) # pull information from html in POST
app.use(methodOverride()) # simulate DELETE and PUT
app.engine 'handlebars', exphbs
defaultLayout: 'main'
helpers: require('./helpers/handlebars-helpers')
app.set('view engine', 'handlebars')
Router.bindRoutes(app)
# Startup database connection and start app
db
.sequelize
.sync
force: false
.complete (err)->
if err
throw err[0]
else
app.listen(config.sitePort)
Cron.start()
console.log 'App started on port ' + config.sitePort