Skip to content

Add option to pass a proxy - #8

Open
iaincollins wants to merge 1 commit into
krasimir:masterfrom
iaincollins:master
Open

Add option to pass a proxy#8
iaincollins wants to merge 1 commit into
krasimir:masterfrom
iaincollins:master

Conversation

@iaincollins

Copy link
Copy Markdown

I appreciate this is unsolicited and we haven't discussed it but it was so small I thought I would fork and do the change anyway as I find it useful, then create a PR if you would like to incorporate this change.

  • If specified the --proxy option is used as a fallback route handler.
  • All requests that would otherwise return a 404 are piped through to the proxy.
  • This can be used to run lambdas and a website under the same hostname/port locally, by starting the website on another port at the same time then just proxying through to it.

Thanks for writing this module! I've found it really useful. I know the Next.js team are working on next dev but this is super helpful until that ships.

I created a repo to show folks how I use now-lambda-runner in projects https://serverless-monorepo.now.sh/ … with the --proxy flag this could be even simpler.

@iaincollins
iaincollins force-pushed the master branch 2 times, most recently from e10816e to 6ae5c32 Compare February 25, 2019 15:37
If specified the --proxy option is used as a fallback route handler.

This can be used to run lambdas and a website under the same hostname/port locally.
Comment thread README.md
* `--config` - path to `now.json` file
* `--port` - by default the local server listens on port 8004. You can change it via this argument. No newline at end of file
* `--port` - by default the local server listens on port 8004. You can change it via this argument.
* `--proxy` - a URL to use as a fallback proxy for requests that would otherwise fail (e.g. `http://localhost:3000`) No newline at end of file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add one sentence saying that this is not a standard now/zeit feature. It is built here for convenience.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look, will do!

Will add to the read README - let me know if you like the inline help to be more explicit too (was torn between keeping it short and explaining a bit more).

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants