Skip to content

Commit 748d5fe

Browse files
authored
Add a note regarding proxying
1 parent b1f266c commit 748d5fe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ http://localhost:9000/hello -> folder/hello.js (must export a handler(event, con
2323

2424
The `build` function will run a single build of the functions in the folder.
2525

26+
### Proxying for local development
27+
28+
When your function is deployed on Netlify, it will be available at `/.netlify/functions/function-name` for any given deploy context. It is advantageous to proxy the `netlify-lambda serve` development server to the same path on your primary development server.
29+
30+
Say you are running `webpack-serve` on port 8080 and `netlify-lambda serve` on port 9000. Mounting `localhost:9000` to `/.netlify/functions/` will closely replicate what the final production environment will look like during development, and will allow you to assume the same function url path in development and in production.
31+
32+
See [netlify/create-react-app-lambda](https://github.com/netlify/create-react-app-lambda/blob/3b5fac5fcbcba0e775b755311d29242f0fc1d68e/package.json#L19) for an example.
33+
2634
## Webpack Configuration
2735

2836
By default the webpack configuration uses `babel-loader` to load all js files. Any `.babelrc` in the directory `netlify-lambda` is run from will be respected. If no `.babelrc` is found, a [few basic settings are used](https://github.com/netlify/netlify-lambda/blob/master/lib/build.js#L11-L15a).

0 commit comments

Comments
 (0)