{"id":19293613,"url":"https://github.com/hayanisaid/aws-lambda-nodejs-example","last_synced_at":"2025-04-22T07:32:21.484Z","repository":{"id":97738776,"uuid":"409039936","full_name":"hayanisaid/AWS-Lambda-nodejs-example","owner":"hayanisaid","description":null,"archived":false,"fork":false,"pushed_at":"2021-09-22T19:34:24.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T20:51:18.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/hayanisaid.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-22T02:31:45.000Z","updated_at":"2021-09-22T19:34:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"9fb2ee9a-2640-48dd-be01-a5c495ccd93a","html_url":"https://github.com/hayanisaid/AWS-Lambda-nodejs-example","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/hayanisaid%2FAWS-Lambda-nodejs-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayanisaid%2FAWS-Lambda-nodejs-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayanisaid%2FAWS-Lambda-nodejs-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hayanisaid%2FAWS-Lambda-nodejs-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hayanisaid","download_url":"https://codeload.github.com/hayanisaid/AWS-Lambda-nodejs-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250195054,"owners_count":21390230,"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":[],"created_at":"2024-11-09T22:35:31.646Z","updated_at":"2025-04-22T07:32:21.466Z","avatar_url":"https://github.com/hayanisaid.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n# AWS-Lambda-nodejs-example\n=======\n# Serverless Framework Node Express API on AWS\n\nThis template demonstrates how to develop and deploy a simple Node Express API service running on AWS Lambda using the traditional Serverless Framework.\n\n## Anatomy of the template\n\nThis template configures a single function, `api`, which is responsible for handling all incoming requests thanks to configured `http` events. To learn more about `http` event configuration options, please refer to [http event docs](https://www.serverless.com/framework/docs/providers/aws/events/apigateway/). As the events are configured in a way to accept all incoming requests, `express` framework is responsible for routing and handling requests internally. Implementation takes advantage of `serverless-http` package, which allows you to wrap existing `express` applications. To learn more about `serverless-http`, please refer to corresponding [GitHub repository](https://github.com/dougmoscrop/serverless-http).\n\n## Usage\n\n### Deployment\n\nThis example is made to work with the Serverless Framework dashboard, which includes advanced features such as CI/CD, monitoring, metrics, etc.\n\nIn order to deploy with dashboard, you need to first login with:\n\n```\nserverless login\n```\n\ninstall dependencies with:\n\n```\nnpm install\n```\n\nand then perform deployment with:\n\n```\nserverless deploy\n```\n\nAfter running deploy, you should see output similar to:\n\n```bash\nServerless: Packaging service...\nServerless: Excluding development dependencies...\nServerless: Creating Stack...\nServerless: Checking Stack create progress...\n........\nServerless: Stack create finished...\nServerless: Uploading CloudFormation file to S3...\nServerless: Uploading artifacts...\nServerless: Uploading service aws-node-express-api.zip file to S3 (711.23 KB)...\nServerless: Validating template...\nServerless: Updating Stack...\nServerless: Checking Stack update progress...\n.................................\nServerless: Stack update finished...\nService Information\nservice: aws-node-express-api\nstage: dev\nregion: us-east-1\nstack: aws-node-express-api-dev\nresources: 12\napi keys:\n  None\nendpoints:\n  ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/\n  ANY - https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/{proxy+}\nfunctions:\n  api: aws-node-express-api-dev-api\nlayers:\n  None\n```\n\n_Note_: In current form, after deployment, your API is public and can be invoked by anyone. For production deployments, you might want to configure an authorizer. For details on how to do that, refer to [http event docs](https://www.serverless.com/framework/docs/providers/aws/events/apigateway/).\n\n### Invocation\n\nAfter successful deployment, you can call the created application via HTTP:\n\n```bash\ncurl https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/\n```\n\nWhich should result in the following response:\n\n```\n{\"message\":\"Hello from root!\"}\n```\n\nCalling the `/hello` path with:\n\n```bash\ncurl https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/hello\n```\n\nShould result in the following response:\n\n```bash\n{\"message\":\"Hello from path!\"}\n```\n\nIf you try to invoke a path or method that does not have a configured handler, e.g. with:\n\n```bash\ncurl https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/nonexistent\n```\n\nYou should receive the following response:\n\n```bash\n{\"error\":\"Not Found\"}\n```\n\n### Local development\n\nIt is also possible to emulate API Gateway and Lambda locally by using `serverless-offline` plugin. In order to do that, execute the following command:\n\n```bash\nserverless plugin install -n serverless-offline\n```\n\nIt will add the `serverless-offline` plugin to `devDependencies` in `package.json` file as well as will add it to `plugins` in `serverless.yml`.\n\nAfter installation, you can start local emulation with:\n\n```\nserverless offline\n```\n\nTo learn more about the capabilities of `serverless-offline`, please refer to its [GitHub repository](https://github.com/dherault/serverless-offline).\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e 44e9278 (initial commit)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhayanisaid%2Faws-lambda-nodejs-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhayanisaid%2Faws-lambda-nodejs-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhayanisaid%2Faws-lambda-nodejs-example/lists"}