Skip to content

Commit

Permalink
fix(CORS): allow to run schnack server and client on localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
g-div committed Jan 3, 2018
1 parent f2c0ed2 commit e724da9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ function getSchnackDomain() {
console.error(`"${config.schnack_host}" doesn't appear to be a proper URL. Did you forget "http://"?`);
process.exit(-1);
}
const schnack_domain = schnack_url.hostname.split('.').slice(1).join('.');
return schnack_domain;

if (schnack_url.hostname === 'localhost') {
return schnack_url.hostname;
} else {
const schnack_domain = schnack_url.hostname.split('.').slice(1).join('.');
return schnack_domain;
}
}

module.exports = {
Expand Down

0 comments on commit e724da9

Please sign in to comment.