Skip to content
Permalink
Browse files

feat(express): use middleware body-parser to parse application/json

  • Loading branch information
jyounce committed Aug 13, 2015
1 parent 23f4483 commit 2e635da61f4b17d8b2504732fe68bcf5e24039b1
Showing with 7 additions and 1 deletion.
  1. +1 −1 config/config-node_modules.coffee
  2. +1 −0 package.json
  3. +5 −0 src/server/server.coffee
@@ -5,7 +5,7 @@ module.exports = (config, options) ->

# modules
# =======
rbModules = ['express']
rbModules = ['express', 'body-parser']
appModules = options.server.node_modules or []

# http proxy
@@ -24,6 +24,7 @@
"conventional-changelog": "~0.0.17"
},
"dependencies": {
"body-parser": "~1.13.3",
"bower": "~1.4.1",
"browser-sync": "~2.8.2",
"coffee-script": "~1.9.3",
@@ -1,6 +1,7 @@
dir = __dirname # all paths are relative to this file
path = require 'path'
express = require 'express'
bodyParser = require 'body-parser'
config = require path.join dir, 'config.json'
app = express()
port = process.env.PORT or config.ports.server
@@ -10,7 +11,11 @@ appFilePath = path.resolve dir, '..', config.dist.app.server.scripts.file
serverDirPath = path.resolve dir, '..', '..', config.dist.app.server.dirName
proxyFilePath = path.join dir, 'http-proxy.js'

# configure
# =========
app.use express.static clientDirPath
app.use bodyParser.json() # parse application/json

app.listen port, ->
console.log "#{config.server.msg.start} #{config.ports.server}"

0 comments on commit 2e635da

Please sign in to comment.
You can’t perform that action at this time.