Adrián Mouly
08/06/2021, 11:21 PMexport class AnotherStack extends Stack {
constructor(scope: App, id: string, props: AnotherStackProps) {
super(scope, id, props);
props.api.addRoutes(this, {
"GET /notes/{id}": "src/get.main",
"PUT /notes/{id}": "src/update.main",
"DELETE /notes/{id}": "src/delete.main",
});
}
}
The thing is my “routes” all need to have the same “base path” like…
/myapp/notes
And I don’t want to put..
props.api.addRoutes(this, {
"GET /myapp/notes/{id}": "src/get.main",
"PUT /myapp/notes/{id}": "src/update.main",
"DELETE /myapp/notes/{id}": "src/delete.main",
});
Is there a way to define the path for only those routes?
I know that I can define the path when creating the API from scratch with customDomain, but not sure how to do on this scenario.Sam Hulick
08/06/2021, 11:48 PMSam Hulick
08/06/2021, 11:50 PMprops.api.addRoutes(this, generateRoutes(this, 'src/path/path2/', { 'GET /x': 'get.main' }))Sam Hulick
08/06/2021, 11:51 PMgenerateRoutes supports mixing just a handler string for your route, or an objectAdrián Mouly
08/07/2021, 6:10 AMFrank
pathFrank
/notes and the other to map to /myapp/notesFrank
Adrián Mouly
08/07/2021, 11:46 PM