A library that supports quick development and deployment for AWS lambda based serverless APIs
Made with ❤ by CertiK.
Prerequisite
Template Setup
Create a start-dev.js
file for dev
import pathModule from "node:path";
import { dirname, startLocalApp, getRoutes } from "@certik/serverless-api/dev.js";
import { handler } from "@certik/serverless-api/entrypoint.js";
async function main() {
const routes = await getRoutes(
pathModule.join(dirname(import.meta.url), "routes"),
);
return startLocalApp({ routes, handler });
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
Create a deploy.js
file for pulumi deployment
import pathModule from "node:path";
import { dirname, createPulumiAPIApp, getRoutes } from "@certik/serverless-api/dev.js";
export default async function main() {
return createPulumiAPIApp({
routes: await getRoutes(
pathModule.join(dirname(import.meta.url), "routes"),
),
});
}
Create a routes
folder, and write handler functions there, an example handler function
export default async function handler(event) {
return {
statusCode: 200,
body: JSON.stringify(event),
};
}
Local Development Workflow
# use doppler
doppler login
doppler setup
# login pulumi
pulumi login
bun run lint
bun run test
bun run dev
Publish
bun run pub