Skip to content

Commit

Permalink
fix: respond correctly to CORS headers (#498)
Browse files Browse the repository at this point in the history
related to #493
  • Loading branch information
jameswestnz authored and gr2m committed May 29, 2016
1 parent f5f3148 commit cb37a29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"good-squeeze": "^3.0.1",
"h2o2": "^5.1.0",
"hapi": "^13.3.0",
"hapi-cors-headers": "^1.0.0",
"inert": "^4.0.0",
"joi": "^8.0.5",
"jsonfile": "^2.3.0",
Expand Down
2 changes: 2 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var bundleClient = require('./bundle-client')
var getConfig = require('./config')
var registerPlugins = require('./plugins')
var userDatabases = require('./utils/user-databases')
var corsHeaders = require('hapi-cors-headers')

function getHoodieServer (options, callback) {
getConfig(options, function (error, config) {
Expand All @@ -27,6 +28,7 @@ function getHoodieServer (options, callback) {

var server = new hapi.Server(hapiConfig)
server.connection(config.connection)
server.ext('onPreResponse', corsHeaders)

async.parallel([
registerPlugins.bind(null, server, config),
Expand Down

0 comments on commit cb37a29

Please sign in to comment.