Justin Kasad
03/07/2021, 2:15 AMCfnOutput to output the endpoint and see it in the logs)
How do I get the SST service to deploy to the same endpoint as the serverless.yml services? The same one that seed.run returns after building. Thank you for your help!Frank
Justin Kasad
03/07/2021, 2:51 AMFrank
sst.Api construct to create the Api endpoint in SST currently?Justin Kasad
03/07/2021, 2:53 AMexport default class MyStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
// Create the HTTP API
const api = new sst.Api(this, "Api", {
routes: {
"GET /house/{id}": "src/get.getHouse",
},
});
api.attachPermissions(sst.PermissionType.ALL);
// Show API endpoint in output
new cdk.CfnOutput(this, "ApiEndpoint", {
value: api.httpApi.apiEndpoint,
});
}
}Justin Kasad
03/07/2021, 2:54 AMFrank
Frank
sst.Api and SST will use that instead of creating a new oneJustin Kasad
03/07/2021, 3:00 AMJustin Kasad
03/07/2021, 3:00 AMFrank
root-api service export the api endpoint as ${stage}-api-endpointFrank
new Api(this, "Api", {
httpApi: apigatewayv2.fromHttpApiAttributes(this, "MyHttpApi", {
httpApiId: cdk.Fn.import_value(`${stage}-api-endpoint`).substring(8, 18),
}),
routes: {
"GET /notes": "src/list.main",
},
});Frank
root-api will export the deployed endpoint ie. pr123-api-endpoint with value <https://mhb5fkpgx9.execute-api.us-east-1.amazonaws.com>Frank
pr123-api-endpoint, parses out mhb5fkpgx9 from the endpoint, and use that to import the Api Gateway HTTP ApiFrank
Justin Kasad
03/07/2021, 3:16 AMFrank
Frank
Justin Kasad
03/07/2021, 7:22 PMFrank