{"id":15471644,"url":"https://github.com/thadeu/serverless-stack-api","last_synced_at":"2026-01-07T21:06:32.861Z","repository":{"id":43968022,"uuid":"250907749","full_name":"thadeu/serverless-stack-api","owner":"thadeu","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-09T22:20:43.000Z","size":3420,"stargazers_count":0,"open_issues_count":24,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-19T01:15:37.235Z","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/thadeu.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":"2020-03-28T22:39:22.000Z","updated_at":"2020-03-30T01:17:25.000Z","dependencies_parsed_at":"2023-02-08T15:01:15.898Z","dependency_job_id":null,"html_url":"https://github.com/thadeu/serverless-stack-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/thadeu%2Fserverless-stack-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thadeu%2Fserverless-stack-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thadeu%2Fserverless-stack-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thadeu%2Fserverless-stack-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thadeu","download_url":"https://codeload.github.com/thadeu/serverless-stack-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246034280,"owners_count":20712851,"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-10-02T02:21:04.875Z","updated_at":"2026-01-07T21:06:32.792Z","avatar_url":"https://github.com/thadeu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless Node.js Starter\n\nA Serverless starter that adds ES7 syntax, serverless-offline, linting, environment variables, and unit test support. Part of the [Serverless Stack](http://serverless-stack.com) guide.\n\n[Serverless Node.js Starter](https://github.com/AnomalyInnovations/serverless-nodejs-starter) uses the [serverless-bundle](https://github.com/AnomalyInnovations/serverless-bundle) plugin (an extension of the [serverless-webpack](https://github.com/serverless-heaven/serverless-webpack) plugin) and the [serverless-offline](https://github.com/dherault/serverless-offline) plugin. It supports:\n\n- **Generating optimized Lambda packages with Webpack**\n- **Use ES7 syntax in your handler functions**\n  - Use `import` and `export`\n- **Run API Gateway locally**\n  - Use `serverless offline start`\n- **Support for unit tests**\n  - Run `npm test` to run your tests\n- **Sourcemaps for proper error messages**\n  - Error message show the correct line numbers\n  - Works in production with CloudWatch\n- **Lint your code with ESLint**\n- **Add environment variables for your stages**\n- **No need to manage Webpack or Babel configs**\n\n---\n\n### Demo\n\nA demo version of this service is hosted on AWS - [`https://z6pv80ao4l.execute-api.us-east-1.amazonaws.com/dev/hello`](https://z6pv80ao4l.execute-api.us-east-1.amazonaws.com/dev/hello)\n\nAnd here is the ES7 source behind it\n\n``` javascript\nexport const hello = async (event, context) =\u003e {\n  return {\n    statusCode: 200,\n    body: JSON.stringify({\n      message: `Go Serverless v1.0! ${(await message({ time: 1, copy: 'Your function executed successfully!'}))}`,\n      input: event,\n    }),\n  };\n};\n\nconst message = ({ time, ...rest }) =\u003e new Promise((resolve, reject) =\u003e\n  setTimeout(() =\u003e {\n    resolve(`${rest.copy} (with a delay)`);\n  }, time * 1000)\n);\n```\n\n### Upgrading from v1.x\n\nWe have detailed instructions on how to upgrade your app to the v2.0 of the starter if you were using v1.x before. [Read about it here](https://github.com/AnomalyInnovations/serverless-nodejs-starter/releases/tag/v2.0).\n\n### Requirements\n\n- [Install the Serverless Framework](https://serverless.com/framework/docs/providers/aws/guide/installation/)\n- [Configure your AWS CLI](https://serverless.com/framework/docs/providers/aws/guide/credentials/)\n\n### Installation\n\nTo create a new Serverless project.\n\n``` bash\n$ serverless install --url https://github.com/AnomalyInnovations/serverless-nodejs-starter --name my-project\n```\n\nEnter the new directory\n\n``` bash\n$ cd my-project\n```\n\nInstall the Node.js packages\n\n``` bash\n$ npm install\n```\n\n### Usage\n\nTo run a function on your local\n\n``` bash\n$ serverless invoke local --function hello\n```\n\nTo simulate API Gateway locally using [serverless-offline](https://github.com/dherault/serverless-offline)\n\n``` bash\n$ serverless offline start\n```\n\nDeploy your project\n\n``` bash\n$ serverless deploy\n```\n\nDeploy a single function\n\n``` bash\n$ serverless deploy function --function hello\n```\n\n#### Running Tests\n\nRun your tests using\n\n``` bash\n$ npm test\n```\n\nWe use Jest to run our tests. You can read more about setting up your tests [here](https://facebook.github.io/jest/docs/en/getting-started.html#content).\n\n#### Environment Variables\n\nTo add environment variables to your project\n\n1. Rename `env.example` to `.env`.\n2. Add environment variables for your local stage to `.env`.\n3. Uncomment `environment:` block in the `serverless.yml` and reference the environment variable as `${env:MY_ENV_VAR}`. Where `MY_ENV_VAR` is added to your `.env` file.\n4. Make sure to not commit your `.env`.\n\n#### Linting\n\nWe use [ESLint](https://eslint.org) to lint your code via the [serverless-bundle](https://github.com/AnomalyInnovations/serverless-bundle) plugin.\n\nYou can turn this off by adding the following to your `serverless.yml`.\n\n``` yaml\ncustom:\n  bundle:\n    linting: false\n```\n\nTo [override the default config](https://eslint.org/docs/user-guide/configuring), add a `.eslintrc.json` file. To ignore ESLint for specific files, add it to a `.eslintignore` file.\n\n### Support\n\n- Open a [new issue](https://github.com/AnomalyInnovations/serverless-nodejs-starter/issues/new) if you've found a bug or have some suggestions.\n- Or submit a pull request!\n\n---\n\nThis repo is maintained by [Anomaly Innovations](https://anoma.ly); makers of [Seed](https://seed.run) and [Serverless Stack](https://serverless-stack.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthadeu%2Fserverless-stack-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthadeu%2Fserverless-stack-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthadeu%2Fserverless-stack-api/lists"}