{"id":21558133,"url":"https://github.com/koopjs/koop-serverless-example","last_synced_at":"2025-04-10T10:41:58.714Z","repository":{"id":42232309,"uuid":"201635295","full_name":"koopjs/koop-serverless-example","owner":"koopjs","description":"An example project to use KoopJS with AWS Lambda + API Gateway","archived":false,"fork":false,"pushed_at":"2023-08-27T22:37:37.000Z","size":1524,"stargazers_count":12,"open_issues_count":15,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:38:17.576Z","etag":null,"topics":["api-gateway","app","aws","koop","lambda","serverless"],"latest_commit_sha":null,"homepage":"","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/koopjs.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-08-10T13:40:55.000Z","updated_at":"2024-06-20T05:16:49.000Z","dependencies_parsed_at":"2023-02-18T02:45:30.180Z","dependency_job_id":null,"html_url":"https://github.com/koopjs/koop-serverless-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/koopjs%2Fkoop-serverless-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koopjs%2Fkoop-serverless-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koopjs%2Fkoop-serverless-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koopjs%2Fkoop-serverless-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koopjs","download_url":"https://codeload.github.com/koopjs/koop-serverless-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199404,"owners_count":21063671,"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":["api-gateway","app","aws","koop","lambda","serverless"],"created_at":"2024-11-24T08:14:04.933Z","updated_at":"2025-04-10T10:41:58.693Z","avatar_url":"https://github.com/koopjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koop-serverless-example\n\nThis example project shows how to deploy [KoopJS](https://koopjs.github.io/) application to AWS Lambda using the [serverless](https://serverless.com/) framework.\n\nrequires Node.js 8+\n\n## Prerequisite\n\nAWS access key with privileges to:\n\n- read/write S3\n- manage Lambda\n- manage API Gateway\n\nThe serverless framework uses the key to deploy and manage Lambda functions on AWS. To know how to setup the credential for serverless, take a look at this [guide](https://serverless.com/framework/docs/providers/aws/guide/credentials/).\n\n## Code\n\n## Koop app\n\nThis example uses the [serverless-http](https://github.com/dougmoscrop/serverless-http) library to wrap an existing Koop app into AWS Lambda.\n\nYou should be able to develop your Koop app much like the usual way. But instead of running directly, the app needs to be exported for serverless:\n\n```javascript\n// src/index.js\n\nconst Koop = require(\"koop\");\nconst serverless = require(\"serverless-http\");\n\n// initiate a Koop app\nconst koop = new Koop();\n\n// configure the Koop app\n\n// wrap the Koop server with the serverless framework\nmodule.exports.handler = serverless(koop.server);\n```\n\nSince the Koop app is going to run as a Lambda function, you may need to reconsider the caching and data persistence strategies.\n\n## serverless.yml\n\nThe Lambda function is configured with the file `servless.yml`. The configuration shows how to configure a lambda function for API Gateway events.\n\n```yaml\nservice: koop-serverless-example\n\nprovider:\n  name: aws\n  runtime: nodejs10.x\n\nfunctions:\n  # Each API should have one corresponding function\n  get-data:\n    handler: src/index.handler\n    events:\n      # The \"http\" event defines an API at the API Gateway\n      - http:\n          path: /my-provider/{host}/FeatureServer/0\n          method: get\n          request:\n            # Each parameter and query string need to be explicitly specified\n            parameters:\n              paths:\n                host: true\n```\n\nFor more details and options, check the [Serverless AWS Guide](https://serverless.com/framework/docs/providers/aws/).\n\n## Development\n\n### Test\n\nThis example uses the [serverless-offline](https://github.com/dherault/serverless-offline) to run the local dev server. Simply runs\n\n```\nnpm run start\n```\n\n### Deploy\n\nDeploy Lambda functions and APIs with one command:\n\n```\nnpm run deploy\n```\n\n### Remove\n\nRemove all deployed Lambda functions and APIs:\n\n```\nnpm run remove\n```\n\n## Lincese\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoopjs%2Fkoop-serverless-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoopjs%2Fkoop-serverless-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoopjs%2Fkoop-serverless-example/lists"}