Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Created May 6, 2024 09:39
Show Gist options
  • Save tsh-code/b879bbadd5439e7e61ca65203ae61283 to your computer and use it in GitHub Desktop.
Save tsh-code/b879bbadd5439e7e61ca65203ae61283 to your computer and use it in GitHub Desktop.
Single function Api stack
import { Api, StackContext, use } from "sst/constructs";
import { Translations } from "./Translations";
export function API({ stack }: StackContext) {
const { translationFn } = use(Translations);
new Api(stack, "translation-api", {
routes: {
"POST /api/translate/{languageCode}": {
cdk: {
function: translationFn,
},
},
},
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment