Skip to content
Permalink
Browse files

fix(server): parsing application/json requests

  • Loading branch information
jyounce committed Oct 14, 2015
1 parent 7c7f8fb commit ba2aa718be11399ffa25c6a67b06a8d960423829

This file was deleted.

@@ -0,0 +1,5 @@
# default app middleware
# ======================
module.exports = (server, config) ->
server.app.use server.express.static server.paths.client
server.app.use server.middleware.bodyParser.json() # parse application/json
@@ -0,0 +1,11 @@
# default app routes
# ==================
module.exports = (server, config) ->
spa = config.spa.dist.file # ex: spa.html

server.app.get '*', (req, res) ->
msg = 'Hello Server!'
return res.send msg unless config.build.client
return res.send msg if config.exclude.spa
return res.send msg if config.env.is.test and not config.env.is.testClient
res.sendFile spa, root: server.paths.client
@@ -0,0 +1,4 @@
# default app settings
# ====================
module.exports = (server, config) ->
server.app.set 'x-powered-by', false # removes this http header
@@ -16,9 +16,14 @@ server.middleware = { bodyParser }
server.paths = client: clientDirPath, server: serverDirPath
server.server = require('./start-server') server.app, config

# load defaults
# =============
require('./defaults/app-settings') server, config
require('./defaults/app-middleware') server, config

# load optional http proxy
# ========================
proxyFilePath = path.join dir, 'http-proxy.js'
proxyFilePath = path.join dir, 'options', 'http-proxy.js'
require(proxyFilePath) server.app, config if config.httpProxy.length

# load optional app server dist entry script
@@ -34,4 +39,4 @@ catch e

# load default app configuration
# ==============================
require('./app-defaults') server, config
require('./defaults/app-routes') server, config
File renamed without changes.

0 comments on commit ba2aa71

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