:wave: how do I add `/api` prefix for all of my en...
# help
k
👋 how do I add
/api
prefix for all of my endpoints? I know there is a way, don't remember how
a
I think something like this:
Copy code
new Api(stack, "Api", {
  customDomain: {
    domainName: "<http://api.domain.com|api.domain.com>",
    hostedZone: "<http://domain.com|domain.com>",
    path: "v1",
  },
  routes: {
    "GET /notes": "src/list.main",
  },
});
https://docs.serverless-stack.com/constructs/Api#using-the-full-config
f
Just to add that if you are not using a custom domain, u’d have to prefix each route
Copy code
routes: {
    "GET /api/notes": "src/list.main",
    "GET /api/notes/{id}": "src/get.main",
  },
k
@Karolis Stulgys I think Frank's way is the one to use, if you like to e.g. avoid CORS by putting the API with special
/api/
path into the same domain as the UI