{"id":20635973,"url":"https://github.com/adrianhdezm/serverless-rest-api","last_synced_at":"2025-05-10T07:30:38.605Z","repository":{"id":40754236,"uuid":"172906005","full_name":"adrianhdezm/serverless-rest-api","owner":"adrianhdezm","description":"Just another Serverless RESTful API based on AWS Lambda","archived":true,"fork":false,"pushed_at":"2023-01-06T13:52:23.000Z","size":426,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T04:02:05.572Z","etag":null,"topics":["aws","aws-lambda","cloudformation","sam-cli","sam-template","serverless","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrianhdezm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-27T11:51:23.000Z","updated_at":"2024-05-31T21:18:02.000Z","dependencies_parsed_at":"2023-02-06T04:47:05.029Z","dependency_job_id":null,"html_url":"https://github.com/adrianhdezm/serverless-rest-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianhdezm%2Fserverless-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianhdezm%2Fserverless-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianhdezm%2Fserverless-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianhdezm%2Fserverless-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianhdezm","download_url":"https://codeload.github.com/adrianhdezm/serverless-rest-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253379412,"owners_count":21899251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-lambda","cloudformation","sam-cli","sam-template","serverless","typescript"],"created_at":"2024-11-16T15:08:40.892Z","updated_at":"2025-05-10T07:30:38.362Z","avatar_url":"https://github.com/adrianhdezm.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless RESTful API example\n\nJust another Serverless RESTful API based on AWS Lambda\n\n## Prerequisites\n\nThe Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.\n\nTo use the SAM CLI, you need the following tools.\n\n- SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)\n- Node.js - [Install Node.js 12](https://nodejs.org/en/), including the NPM package management tool.\n- Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition\u0026offering=community)\n\n## Use the SAM CLI to build and test locally\n\nBuild your application with the `sam build` command.\n\n```bash\nnpm run build\nsam build  -m ./package.json -t ./templates/service.yaml\n```\n\nThe SAM CLI installs dependencies defined in `package.json`, creates a deployment package, and saves it in the `.aws-sam/build` folder.\n\nTest a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.\n\nRun functions locally and invoke them with the `sam local invoke` command.\n\n```bash\nsam local invoke HelloWorldFunction -t ./templates/service.yaml -e events/api-gateway.json\n```\n\nThe SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.\n\n```bash\nsam local start-api -t ./templates/service.yaml\ncurl http://localhost:3000/hello\n```\n\nThe SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The `Events` property on each function's definition includes the route and method for each path.\n\n```yaml\nEvents:\n  HelloWorld:\n    Type: Api\n    Properties:\n      Path: /hello\n      Method: get\n```\n\n## Use the SAM CLI to deploy to AWS\n\nTo build and deploy your application, run the following in your shell:\n\n```bash\nnpm run build\nsam sam build  -m ./package.json -t ./templates/service.yaml\nsam deploy --guided\n```\n\n## Unit tests\n\nTests are defined in the `tests` folder in this project. Use NPM to install the [Jest testing framework](https://jestjs.io) and run unit tests.\n\n```bash\nnpm run test\n```\n\n## Cleanup\n\nTo delete the application stack, use the following AWS CLI command:\n\n```bash\naws cloudformation delete-stack --stack-name hello-world\n```\n\n## Add a resource to the application\n\nThe application template uses AWS Serverless Application Model (AWS SAM) to define application resources. AWS SAM is an extension of AWS CloudFormation with a simpler syntax for configuring common serverless application resources such as functions, triggers, and APIs. For resources not included in [the SAM specification](https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md), you can use standard [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) resource types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianhdezm%2Fserverless-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianhdezm%2Fserverless-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianhdezm%2Fserverless-rest-api/lists"}