Dan Van Brunt
10/21/2021, 3:13 PMsst.ApolloApi
to use a custom path? We’d like the root method to be at /api
This is so that we can put the api behind a Cloundfront Distro as a reverse proxy at <http://mydomain.com/api|mydomain.com/api>
CF origins seem to always pass the path from the front end, so there is no way to have it be /api
on the distro and /
behind the scenes. (at least without a cloudfront function)
Annoying I know.Dan Van Brunt
10/21/2021, 3:16 PMsst.ApolloApi
needs a rootRoute
property?
I am curious what ApolloApi really gives you over just using sst.Api
. Going to look at constructDan Van Brunt
10/21/2021, 3:23 PMrootRoute
no?
routeRoute: /api
(default: /
)
…
routes: {
`GET ${routeRoute}`: server,
`POST ${routeRoute}`: server,
},
thdxr
10/21/2021, 3:25 PMthdxr
10/21/2021, 3:25 PMDan Van Brunt
10/21/2021, 3:25 PMrootRoute
as aboveDan Van Brunt
10/21/2021, 3:28 PMsst.ApolloApi
if its less code 🙂Dan Van Brunt
10/21/2021, 3:33 PMDan Van Brunt
10/21/2021, 3:38 PMthdxr
10/21/2021, 3:39 PMDan Van Brunt
10/21/2021, 3:43 PMReroute
construct that would implement a CF Function to do nothing more but reroute from
to
by attaching a FunctionAssociation to a behavior.
eg…
new Reroute(this, {
behavior,
from: '/api/*',
to: '/*'
})
🙂Dan Van Brunt
10/21/2021, 3:44 PMDan Van Brunt
10/21/2021, 3:52 PMFrank
rootRoute
option makes sense. I might call it just route
.Frank
Frank
Reroute
is interesting idea too.. but having a route
option seems more straight forward in this case.Dan Van Brunt
10/21/2021, 6:24 PMroute
to be confused with sst.Api
’s routes
as route
would only be the string route and not the method or anything else.Dan Van Brunt
10/21/2021, 6:24 PMDan Van Brunt
10/21/2021, 7:26 PMFrank
rootRoute
and rootPath
, which do u prefer? I lean towards rootPath
more.Dan Van Brunt
10/21/2021, 10:21 PMDan Van Brunt
10/21/2021, 10:22 PMFrank
Frank