Skip to content

Commit

Permalink
add weekly & opt ui
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-tang committed Aug 13, 2014
1 parent 6b15e00 commit 806656f
Show file tree
Hide file tree
Showing 15 changed files with 975 additions and 407 deletions.
30 changes: 23 additions & 7 deletions app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@ data = require './data'

port = 8457

nb = nobone {
{ kit, proxy, renderer, service } = nobone {
proxy: {}
renderer: {}
service: {}
}

# Server
nb.service.get '/', (req, res) ->
nb.renderer.render('index.ejs')
# weekly = require './weekly'
# service.get '/', (req, res) ->
# renderer.render('index.ejs')
# .done (tpl_func) ->
# res.send tpl_func( { members: data.members, weekly: weekly } )

# service.get '/weekly/:title', (req, res) ->
# md = 'weekly/' + req.params['title']
# kit.fileExists(md)
# .done (rs) ->
# if rs
# renderer.render(md)
# .done (rs) ->
# res.send {error: '200', post: rs}
# else
# res.send {error: '404'}

service.get '/', (req, res) ->
renderer.render('index.ejs')
.done (tpl_func) ->
res.send tpl_func( { members: data.members } )

nb.service.listen port
nb.kit.log 'Listen port ' + port
service.listen port
kit.log 'Listen port ' + port

nb.service.use nb.renderer.static()
service.use renderer.static()
8 changes: 8 additions & 0 deletions build.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ process.env.NODE_ENV = 'production'

data = require './data'
nobone = require 'nobone'
_ = require 'lodash'

nb = nobone {
proxy: {}
Expand All @@ -13,6 +14,13 @@ log = nb.kit.log
render = nb.renderer.render
write = nb.kit.outputFile

# # complie md
# weekly = []
# nb.kit.readdir('weekly')
# .done (rs) ->
# weekly = _.without(rs, 'img').reverse()
# write 'weekly.json', JSON.stringify(weekly)

# complie html
render('index.ejs')
.done (tpl_func) ->
Expand Down
Loading

0 comments on commit 806656f

Please sign in to comment.