Skip to content

Commit

Permalink
Add back --cors option (#527)
Browse files Browse the repository at this point in the history
* add back cors option

* fix linting

* move above compress handler

* Update serve.js
  • Loading branch information
TrevorDev authored and leo committed Dec 30, 2019
1 parent cbc6c4a commit 6213de8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/serve.js
Expand Up @@ -184,6 +184,9 @@ const startEndpoint = (endpoint, config, args, previous) => {
const httpMode = args['--ssl-cert'] && args['--ssl-key'] ? 'https' : 'http';

const serverHandler = async (request, response) => {
if (args['--cors']) {
response.setHeader('Access-Control-Allow-Origin', '*');
}
if (compress) {
await compressionHandler(request, response);
}
Expand Down Expand Up @@ -366,6 +369,7 @@ const loadConfig = async (cwd, entry, args) => {
'--no-compression': Boolean,
'--no-etag': Boolean,
'--symlinks': Boolean,
'--cors': Boolean,
'--ssl-cert': String,
'--ssl-key': String,
'-h': '--help',
Expand All @@ -377,6 +381,7 @@ const loadConfig = async (cwd, entry, args) => {
'-n': '--no-clipboard',
'-u': '--no-compression',
'-S': '--symlinks',
'-C': '--cors',
// This is deprecated and only for backwards-compatibility.
'-p': '--listen'
});
Expand Down

0 comments on commit 6213de8

Please sign in to comment.