{"id":13701258,"url":"https://github.com/activescott/serverless-aws-static-file-handler","last_synced_at":"2025-09-08T10:32:43.876Z","repository":{"id":29236250,"uuid":"116552009","full_name":"activescott/serverless-aws-static-file-handler","owner":"activescott","description":"Easily serve static files with the Serverless Framework on AWS Lambda.","archived":false,"fork":false,"pushed_at":"2024-05-01T22:32:00.000Z","size":6853,"stargazers_count":52,"open_issues_count":10,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-11T21:25:46.330Z","etag":null,"topics":["aws-lambda","binary","nodejs","serverless","serverless-architectures","serverless-framework","serverless-functions","serverless-plugin"],"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/activescott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2018-01-07T09:07:10.000Z","updated_at":"2024-05-03T05:42:27.000Z","dependencies_parsed_at":"2023-12-16T02:30:52.524Z","dependency_job_id":"0952c6ef-db92-4390-8161-bd068d366346","html_url":"https://github.com/activescott/serverless-aws-static-file-handler","commit_stats":{"total_commits":228,"total_committers":9,"mean_commits":"25.333333333333332","dds":0.5087719298245614,"last_synced_commit":"9ebe4c0660e20ecd4b49d6bef14046be85e2895a"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activescott%2Fserverless-aws-static-file-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activescott%2Fserverless-aws-static-file-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activescott%2Fserverless-aws-static-file-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activescott%2Fserverless-aws-static-file-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/activescott","download_url":"https://codeload.github.com/activescott/serverless-aws-static-file-handler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232302272,"owners_count":18502114,"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-lambda","binary","nodejs","serverless","serverless-architectures","serverless-framework","serverless-functions","serverless-plugin"],"created_at":"2024-08-02T20:01:25.030Z","updated_at":"2025-01-03T06:47:35.397Z","avatar_url":"https://github.com/activescott.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/serverless-aws-static-file-handler.svg)](https://www.npmjs.com/package/serverless-aws-static-file-handler)\n[![npm](https://img.shields.io/npm/dt/serverless-aws-static-file-handler.svg?logo=npm)](https://www.npmjs.com/package/serverless-aws-static-file-handler)\n[![Build Status](https://github.com/activescott/serverless-aws-static-file-handler/workflows/build/badge.svg)](https://github.com/activescott/serverless-aws-static-file-handler/actions)\n[![Coverage Status](https://coveralls.io/repos/github/activescott/serverless-aws-static-file-handler/badge.svg)](https://coveralls.io/github/activescott/serverless-aws-static-file-handler)\n[![License](https://img.shields.io/github/license/activescott/serverless-aws-static-file-handler.svg)](https://github.com/activescott/serverless-aws-static-file-handler/blob/master/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/activescott/serverless-aws-static-file-handler.svg?style=social)](https://github.com/activescott/serverless-aws-static-file-handler)\n\n# serverless-aws-static-file-handler\n\nHost the front-end of your web applications on [Serverless framework](https://github.com/serverless/serverless) on AWS Lambda right alongside the API.\n\nIt is a fast and easy way to get started and makes it trivial to deploy your web applications. If you need better response time in the future and get concerned about AWS costs of using Lambda to static content, you put CloudFront in front of your Serverless endpoints service static content.\n\n\u003c!-- TOC --\u003e\n\n- [Usage / Quick Start](#usage--quick-start)\n- [Prerequisites / Usage Requirements](#prerequisites--usage-requirements)\n- [Install](#install)\n- [Features](#features)\n- [Contributing 🤝](#contributing-🤝)\n- [Show your support](#show-your-support)\n- [Release Process (Deploying to NPM)](#release-process-deploying-to-npm)\n- [License 📝](#license-📝)\n\n\u003c!-- /TOC --\u003e\n\n## Usage / Quick Start\n\nImport \u0026 initialize:\n\n    const StaticFileHandler = require('serverless-aws-static-file-handler')\n\n    # configure where to serve files from:\n    const clientFilesPath = path.join(__dirname, \"./data-files/\")\n    const fileHandler = new StaticFileHandler(clientFilesPath)\n\nDefine a handler in your code as follows:\n\n    module.exports.html = async (event, context) =\u003e {\n      event.path = \"index.html\" // forcing a specific page for this handler, ignore requested path. This would serve ./data-files/index.html\n      return fileHandler.get(event, context)\n    }\n\nIn your `serverless.yml` file, reference the handler function from above to provide routes to your static files:\n\n    functions:\n      html:\n        handler: handler.html\n        events:\n          - http:\n              path: /\n              method: get\n\n      # Note Binary files work too! See configuration information below\n      png:\n        handler: handler.png\n        events:\n          - http:\n              path: png\n              method: get\n\n      # The following example uses a path placeholder to serve all files directly in the /binary/ directory:\n      binary:\n        handler: handler.binary\n        events:\n          - http:\n            path: /binary/{pathvar+}\n            method: get\n\nTo serve binary content make sure that you setup the plugin in your serverless.yml like so:\n\n    plugins:\n      - serverless-aws-static-file-handler/plugins/BinaryMediaTypes\n\n    custom:\n      apiGateway:\n        binaryMediaTypes:\n          - \"image/png\"\n          - \"image/jpeg\"\n\nSome additional real-world examples are demonstrated in the [examples/basic/](examples/basic) directory as well as a [serverless-offline](https://github.com/dherault/serverless-offline)-specific example in [examples/serverless-offline/](examples/serverless-offline).\n\n## Prerequisites / Usage Requirements\n\nRequires Node.js latest, LTS, or v10 ([tested](https://github.com/activescott/serverless-aws-static-file-handler/actions)).\n\nRequires Serverless Framework v1.x.\nIf you are new to the Serverless Framework, check out the [Serverless Framework Getting Started Guide](https://serverless.com/framework/docs/getting-started/).\n\n## Install\n\nInstall with yarn (`yarn add serverless-aws-static-file-handler`) or npm (`npm install serverless-aws-static-file-handler --save-prod`)\n\n## Features\n\n- Simple to get started\n- Works with **text files** such as HTML or **binary** files such as images or fonts\n\n## Contributing 🤝\n\nThis is a community project. We invite your participation through issues and pull requests! You can peruse the [contributing guidelines](.github/CONTRIBUTING.md).\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n## Release Process (Deploying to NPM)\n\nWe use [semantic-release](https://github.com/semantic-release/semantic-release) to consistently release [semver](https://semver.org/)-compatible versions. This project deploys to multiple [npm distribution tags](https://docs.npmjs.com/cli/dist-tag). Each of the below branches correspond to the following npm distribution tags:\n\n| branch | npm distribution tag |\n| ------ | -------------------- |\n| main   | latest               |\n| beta   | beta                 |\n\nTo trigger a release use a Conventional Commit following [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines) on one of the above branches.\n\n## License 📝\n\nCopyright © 2017 [scott@willeke.com](https://github.com/activescott).\n\nThis project is [MIT](https://github.com/activescott/serverless-http-invoker/blob/master/LICENSE) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivescott%2Fserverless-aws-static-file-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factivescott%2Fserverless-aws-static-file-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivescott%2Fserverless-aws-static-file-handler/lists"}