Skip to content

Configuring routes and secure my serverless functions #3888

Answered by paulogdm
jam3sn asked this question in General
Discussion options

You must be logged in to vote

Hey @jam3sn , thanks for experimenting GitHub discussions on our repository!

First, let's start with a few relevant links:

Based on what you provided, I suggest the following:

{
  "build": {
    "env": {
      "GO_BUILD_FLAGS": "-ldflags '-s -w'"
    }
  },
  "rewrites": [
    { "source": "/api/v1/hello", "destination": "/api/hello.go" },
    { "source": "/(.*)", "destination": "/404.html" }
  ],
  "env": {
    "API_TOKEN": "@api-token"
  },
  "regions": ["lhr1"]
}

The first rewrite configuration will send the response from your API. I recommend that you set headers in the serverless f…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jam3sn
Comment options

Answer selected by mcsdevv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants