Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sdd/serverless-apig-s3
https://github.com/sdd/serverless-apig-s3
aws aws-apigateway aws-lambda aws-s3 serverless serverless-plugin
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sdd/serverless-apig-s3
- Owner: sdd
- License: mit
- Created: 2017-04-18T18:23:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:22:41.000Z (11 months ago)
- Last Synced: 2024-04-14T23:10:32.096Z (7 months ago)
- Topics: aws, aws-apigateway, aws-lambda, aws-s3, serverless, serverless-plugin
- Language: JavaScript
- Size: 28.3 KB
- Stars: 29
- Watchers: 4
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serverless-apig-s3
This Serverless plugin automates the process of both configuring AWS to serve static front-end
content and deploying your client-side bundle.It creates an S3 bucket to hold your front-end content, and adds two routes to API Gateway:
* `GET / => bucket/index.html`
* `GET /assets/* => bucket/*`This allows your API and front-end assets to be served from the same domain, sidestepping
any CORS issues. CloudFront is also not used. The combination of these two properties
makes this plugin a good fit for a dev stage environment.### Installation
```bash
npm i -D serverless-apig-s3
```This plugin requires node > 7.6 because fuck callbacks.
### Configuration
serverless.yml:
```yaml
plugins:
- serverless-apig-s3custom:
apigs3:
dist: client/dist # path within service to find content to upload (default: client/dist)
dotFiles: true # include files beginning with a dot in resources and uploads (default: false)
topFiles: true # create routes for top-level files in dist folder (default: false)
resourceName: static # route path for static assets (default: assets)
resourcePath: /dist # path prefix for assets in s3 bucket (default: '')
```### Usage
```bash
sls deploy # ensure that sls deploy has been run so that this plugin's resources exist.
sls client deploy # uploads client build artifacts to s3
```Something missing? More documentation? All Issues / PRs welcome at https://github.com/sdd/serverless-apig-s3