Skip to content

Commit

Permalink
Update index.md (#24657)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjoeio authored Jun 10, 2020
1 parent c31ef6f commit f0cb87b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/blog/2018-12-17-turning-the-static-dynamic/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,18 @@ For more info or configuration options (e.g. in different branches and build env
4. **Proxy the emulated functions for local development**: Head to `gatsby-config.js` and add this to your `module.exports`:

```jsx:title=gatsby-config.js
var proxy = require("http-proxy-middleware")
const { createProxyMiddleware } = require("http-proxy-middleware") //v1.x.x
// Use implicit require for v0.x.x of 'http-proxy-middleware'
// const proxy = require('http-proxy-middleware')
// be sure to replace 'createProxyMiddleware' with 'proxy' where applicable

module.exports = {
// for avoiding CORS while developing Netlify Functions locally
// read more: https://www.gatsbyjs.org/docs/api-proxy/#advanced-proxying
developMiddleware: app => {
app.use(
"/.netlify/functions/",
proxy({
createProxyMiddleware({
target: "http://localhost:9000",
pathRewrite: {
"/.netlify/functions/": "",
Expand Down

0 comments on commit f0cb87b

Please sign in to comment.