This project provides a starter template for building AWS Lambda functions with Node.js. It includes a router, a local development setup, and a PostgreSQL utility and bearer token authentication.
index.mjs
: Main entry point for the Lambda functionrouter.mjs
: Handles routing for different API endpointslocal.mjs
: Provides local development setuputils/pg.mjs
: Utility for PostgreSQL database operationsapi/
: Contains API endpoint handlershealth-check/get.mjs
: Handles GET requests for health checksping/get.mjs
: Ping pong handlerdata/post.mjs
: Example of how to handles POST requests for dataget.mjs
: Example of how to handles GET requests
- To create a new endpoint, create a directory in the
api/
folder and add your handler file with the appropriate method (get, post, put, delete)
- Clone this repository
- Install dependencies:
npm install
- Set up your environment variables (copy .env.example to .env and fill in the values)
- Run locally:
npm run dev
Deploy to AWS Lambda using your preferred method (e.g., AWS CLI, Serverless Framework, or AWS Console).
See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.