0.3.7 • Published 9 months ago

@certik/serverless-api v0.3.7

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

serverless API provider

A library that supports quick development and deployment for AWS lambda based serverless APIs

Made with ❤ by CertiK.

Prerequisite

Template Setup

Create a dev.js file for dev

import pathModule from "node:path";
import { dirname, startLocalApp, getRoutes } from "@certik/serverless-api";

async function main() {
  const routes = await getRoutes(
    pathModule.join(dirname(import.meta.url), "routes"),
  );

  return startLocalApp({ routes });
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});

Create a index.js file for pulumi deployment

import pathModule from "node:path";
import { dirname, createPulumiAPIApp, getRoutes } from "@certik/serverless-api";

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
0.3.7

9 months ago

0.3.6

9 months ago

0.3.5

10 months ago

0.3.4

10 months ago

0.3.3

10 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.0

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago