How to link Gatsby.js with my Express server
Add this to your Gatsby-config file
module.exports = {
proxy: {
prefix: "/users",
url: "http://localhost:3000",
},
}
This way, when you fetch('/users/todos') in development, the development server will recognize that it’s not a static asset, and will proxy your request to http://localhost:3000/users/todos as a fallback.