Devin
12/05/2021, 7:56 PM// Create a HTTP API
const api = new sst.Api(this, "Api", {
defaultAuthorizationType: "AWS_IAM",
defaultFunctionProps: {
environment: {
TABLE_NAME: myCoolTable.tableName,
},
},
// prettier-ignore
routes: {
"GET /someAuthRoute": "src/doTheThing.main",
"POST /newsletter-signup": "src/newsletterSignUp.main" // I want this to be accessibly just from <http://www.myCoolDomain.com|www.myCoolDomain.com>
},
});
api.attachPermissions([myCoolTable]);
const auth = new sst.Auth(this, "Auth", {
cognito: {
userPool: {
signInAliases: { email: true },
},
},
});
auth.attachPermissionsForAuthUsers([
// Allow access to the API
api,
]);
Now, I’d like my domain to be able to post to /newsletter-signup
and add someone to the table. But the way I have the table set you need to be logged in. And what I want is anyone to be able to sign up. I “could” just make another API and table, but it seems like there’s probably a better way?Ross Coundon
12/05/2021, 7:59 PMauthorizationType: sst.ApiAuthorizationType.NONE
Devin
12/05/2021, 8:11 PM