{"id":21216678,"url":"https://github.com/jackhowa/comic-colors","last_synced_at":"2025-12-30T17:29:39.541Z","repository":{"id":78849817,"uuid":"382177865","full_name":"JackHowa/comic-colors","owner":"JackHowa","description":"Goes with https://github.com/JackHowa/marvel-color-switcher","archived":false,"fork":false,"pushed_at":"2022-12-14T06:52:03.000Z","size":23,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T16:44:40.581Z","etag":null,"topics":["serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JackHowa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-01T23:16:10.000Z","updated_at":"2023-03-07T13:47:33.000Z","dependencies_parsed_at":"2023-03-12T05:59:56.547Z","dependency_job_id":null,"html_url":"https://github.com/JackHowa/comic-colors","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/JackHowa%2Fcomic-colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHowa%2Fcomic-colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHowa%2Fcomic-colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackHowa%2Fcomic-colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JackHowa","download_url":"https://codeload.github.com/JackHowa/comic-colors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243667965,"owners_count":20328036,"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":["serverless"],"created_at":"2024-11-20T21:55:07.170Z","updated_at":"2025-12-30T17:29:39.506Z","avatar_url":"https://github.com/JackHowa.png","language":"JavaScript","readme":"# Serverless Framework Node Express API on AWS\n\nThis template demonstrates how to develop and deploy a simple Node Express API service, backed by DynamoDB database, running on AWS Lambda using the traditional Serverless Framework.\n\n\n## Anatomy of the template\n\nThis template configures a single function, `api`, in `serverless.yml` 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). Additionally, it also handles provisioning of a DynamoDB database that is used for storing data about users. The `express` application exposes two endpoints, `POST /users` and `GET /user/{userId}`, which allow to create and retrieve users.\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-dynamodb-api.zip file to S3 (718.53 KB)...\nServerless: Validating template...\nServerless: Updating Stack...\nServerless: Checking Stack update progress...\n....................................\nServerless: Stack update finished...\nService Information\nservice: aws-node-express-dynamodb-api\nstage: dev\nregion: us-east-1\nstack: aws-node-express-dynamodb-api-dev\nresources: 13\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-dynamodb-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/). Additionally, in current configuration, DynamoDB Table will be removed when running `serverless remove`. To retain DynamoDB Table even after removal of the stack, add `DeletionPolicy: Retain` to its resource definition.\n\n### Invocation\n\nAfter successful deployment, you can create a new user by calling the corresponding endpoint:\n\n```bash\ncurl --request POST 'https://xxxxxx.execute-api.us-east-1.amazonaws.com/dev/users' --header 'Content-Type: application/json' --data-raw '{\"name\": \"John\", \"userId\": \"someUserId\"}'\n```\n\nWhich should result in the following response:\n\n```bash\n{\"userId\":\"someUserId\",\"name\":\"John\"}\n```\n\nYou can later retrieve the user by `userId` by calling the following endpoint:\n\n```bash\ncurl https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/users/someUserId\n```\n\nWhich should result in the following response:\n\n```bash\n{\"userId\":\"someUserId\",\"name\":\"John\"}\n```\n\nIf you try to retrieve user that does not exist, you should receive the following response:\n\n```bash\n{\"error\":\"Could not find user with provided \\\"userId\\\"\"}\n```\n\n### Local development\n\nIt is also possible to emulate DynamodB, API Gateway and Lambda locally by using `serverless-dynamodb-local` and `serverless-offline` plugins. In order to do that, execute the following commands:\n\n```bash\nserverless plugin install -n serverless-dynamodb-local\nserverless plugin install -n serverless-offline\n```\n\nIt will add both plugins to `devDependencies` in `package.json` file as well as will add it to `plugins` in `serverless.yml`. Make sure that `serverless-offline` is listed as last plugin in `plugins` section:\n\n```\nplugins:\n  - serverless-dynamodb-local\n  - serverless-offline\n```\n\nYou should also add the following config to `custom` section in `serverless.yml`:\n\n```\ncustom:\n  (...)\n  dynamodb:\n    start:\n      migrate: true\n    stages:\n      - dev\n```\n\nAdditionally, we need to reconfigure `AWS.DynamoDB.DocumentClient` to connect to our local instance of DynamoDB. We can take advantage of `IS_OFFLINE` environment variable set by `serverless-offline` plugin and replace:\n\n```javascript\nconst dynamoDbClient = new AWS.DynamoDB.DocumentClient();\n```\n\nwith the following:\n\n```javascript\nconst dynamoDbClientParams = {};\nif (process.env.IS_OFFLINE) {\n  dynamoDbClientParams.region = 'localhost'\n  dynamoDbClientParams.endpoint = 'http://localhost:8000'\n}\nconst dynamoDbClient = new AWS.DynamoDB.DocumentClient(dynamoDbClientParams);\n```\n\nAfter that, running the following command with start both local API Gateway emulator as well as local instance of emulated DynamoDB:\n\n```bash\nserverless offline start\n```\n\nTo learn more about the capabilities of `serverless-offline` and `serverless-dynamodb-local`, please refer to their corresponding GitHub repositories:\n- https://github.com/dherault/serverless-offline\n- https://github.com/99x/serverless-dynamodb-local\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackhowa%2Fcomic-colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackhowa%2Fcomic-colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackhowa%2Fcomic-colors/lists"}