Created
May 6, 2024 09:39
-
-
Save tsh-code/b879bbadd5439e7e61ca65203ae61283 to your computer and use it in GitHub Desktop.
Single function Api stack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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