An adapter for [SvelteKit](https://kit.svelte.dev/) for AWS Lambda. [Serverless](https://www.serverless.com/) or [CDK](https://aws.amazon.com/cdk/) deployment.
npm install @yarbsemaj/adapter-lambdaAn adapter to build a SvelteKit app into a lambda ready for deployment with lambda proxy via the Serverless framework or CDK.
npm install --save-dev @yarbsemaj/adapter-lambda
`
Usage
In your
svelte.config.js configure the adapter as below;`js
import serverless from '@yarbsemaj/adapter-lambda';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';/* @type {import('@sveltejs/kit').Config} /
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: serverless() //See Below for optional arguments
}
};
export default config;
`$3
Copy serverless.yml from the root of this repo to the root of your project, make sure to change the service name.After building your app run
sls deploy to deploy code to AWS using the build tool serverless.An example project using serverless can be found here.
$3
Copy SvelteKitSite.ts from the root of this repo into your project and add it to a CDK stack.Deploy your stack using
cdk deploy --all`An example project using cdk can be found here.