Adrián Mouly
06/15/2021, 4:27 AMservices
- apiGateway -> defines root for /tasks + custom authorizer function -> this uses REST API
- tasksApi -> defines functions for /tasks + references API GW defined above from CF resources
- surveyApi -> defines functions for /tasks/{id}/surveys + references API GW defined above from CF resources
So my idea is to migrate these 3 projects into 3 separated SST projects / stacks.
services
- main -> defines MainStack -> contains the API root + Authorizer
- tasksApi -> defines TasksApiStack -> contains functions + references MainStack (how?)
- surveyApi -> defines SurveyApiStack -> contains functions + references MainStack (how?)
Is there any recommendation or best practices on how to do this? Should I use this structure of separated services, or should I move into 1 single SST project with many-stacks?Frank
Frank
Frank
Frank
Frank
Strategy 11. Move 1 stack at the time, ie. start with
surveyApi
. So, you’d first create a new surveyApi
stack in the SST app, and it will import ur existing REST API, and add ie. /tasks/{id}/surveys_new
2. Then change your frontend to point to /tasks/{id}/surveys_new
3. After no more requests are hitting /tasks/{id}/surveys
, you can safely remove the surveyApi
SLS service
4. Follow the same strategy to move over the other services.Frank
Strategy 21. Create a new Api in SST app, and proxy all the routes to ur existing REST API. 2. Then switch your frontend to call the new Api domain. Everything should work as before since all requests passes through the new Api. 3. Then you can start adding
/
, /tasks
, /tasks/{id}/surveys
routes to the new Api. As each route you add, the new Api will now handle it’s request, while all unhandled routes get proxied to the old REST API.Frank
Frank
Adrián Mouly
06/15/2021, 12:47 PMAdrián Mouly
06/15/2021, 12:52 PMFrank
Frank
Adrián Mouly
06/15/2021, 7:04 PMAdrián Mouly
06/15/2021, 7:04 PMFrank
Frank
Frank
Adrián Mouly
06/23/2021, 12:02 AMAdrián Mouly
06/23/2021, 12:02 AMAdrián Mouly
06/23/2021, 12:02 AMAdrián Mouly
06/23/2021, 12:02 AMAdrián Mouly
06/23/2021, 1:10 AMFrank
Adrián Mouly
06/23/2021, 7:43 AMAdrián Mouly
06/23/2021, 7:43 AMAdrián Mouly
06/23/2021, 7:50 AM.js
, can we do something with TS?Adrián Mouly
06/23/2021, 7:51 AM.ts
but the rest of the code is .js
.Frank
Frank
Adrián Mouly
06/23/2021, 2:16 PM