Skip to content

Commit

Permalink
Add cors
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinGian committed Dec 18, 2018
1 parent 45620a8 commit 3be11c6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
const proxy = require("express-http-proxy");
const app = require("express")();
const argv = require("yargs").argv;
const cors = require("cors");

if (!argv.url) throw new Error("Must pass a url param");

const PORT = argv.port || 8080;

app.use(cors());

app.all("*", proxy(argv.url));

app.listen(PORT, () => {
Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"license": "MIT",
"dependencies": {
"express": "^4.16.4",
"cors": "^2.8.5",
"express-http-proxy": "^1.5.0",
"yargs": "^12.0.5"
}
Expand Down

0 comments on commit 3be11c6

Please sign in to comment.