diff --git a/app/adapters/application.js b/app/adapters/application.js index 4b3288e..f84ff37 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -1,13 +1,15 @@ import DS from "ember-data"; export default DS.RESTAdapter.extend({ + host: 'http://localhost:4200', + // set namespace to api.php in same subdirectory namespace: window.location.pathname // remove index.html if it's there .replace(/index.html$/, '') // remove tests prefix which are added if tests are running - .replace(/tests/, '') + .replace(/\/\d+\/tests/, '') // remove leading and trailing slash .replace(/\/$/, '') // add api.php diff --git a/package.json b/package.json index 784d15a..a35a552 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "broccoli-merge-trees": "^0.2.1", "broccoli-static-compiler": "~0.2.1", "connect-restreamer": "^1.0.1", + "cors": "^2.5.3", "ember-cli": "0.1.7", "ember-cli-6to5": "0.2.1", "ember-cli-build-info": "0.0.4", diff --git a/server/index.js b/server/index.js index ad3e2a2..314d838 100644 --- a/server/index.js +++ b/server/index.js @@ -13,6 +13,10 @@ module.exports = function(app) { var mocks = globSync('./mocks/**/*.js', { cwd: __dirname }).map(require); var proxies = globSync('./proxies/**/*.js', { cwd: __dirname }).map(require); + /* use cors for testem requests */ + var cors = require('cors'); + app.use(cors()); + /* use node-phpcgi to handle api */ var phpcgi = require('node-phpcgi')({ documentRoot: __dirname.substring(0, __dirname.length - 6) + '/dist',