https://github.com/kiva/lambda-view-server
A no-db web server using AWS Lambda
https://github.com/kiva/lambda-view-server
isomorphic lambda serverless
Last synced: 3 months ago
JSON representation
A no-db web server using AWS Lambda
- Host: GitHub
- URL: https://github.com/kiva/lambda-view-server
- Owner: kiva
- License: mit
- Created: 2017-04-28T21:13:42.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T06:21:50.000Z (about 3 years ago)
- Last Synced: 2024-04-13T09:17:37.654Z (almost 2 years ago)
- Topics: isomorphic, lambda, serverless
- Language: JavaScript
- Homepage:
- Size: 674 KB
- Stars: 3
- Watchers: 45
- Forks: 1
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lambda-view-server
A no-db web server using [Serverless](https://serverless.com/)/[AWS Lambda](https://aws.amazon.com/lambda/)
## Setup
### Local dependencies
Bring in project dependencies with [Yarn](https://yarnpkg.com)
```bash
yarn global add serverless webpack
yarn install
```
They can also be installed with npm if you prefer
```bash
npm install -g serverless webpack
npm install
```
### AWS setup
Follow the [credentials guide](https://serverless.com/framework/docs/providers/aws/guide/credentials/) from Serverless to configure this project to use your AWS account.
### Environment variables
This project expects the following environment variables to be present
```
AWS_API_HOST: the url of the api that uses the lambda function (AWS Gateway API url)
AWS_S3_BUCKET: the S3 bucket where the static resources are deployed
AWS_STATIC_ROOT: the publicly accessible url of the S3 bucket
```
Configure those variables as appropriate for your system.
## Usage
To build the project and deploy to AWS
```bash
# using yarn
yarn deploy
# using npm
npm run deploy
```
To run the function locally
```bash
# with no parameters
sls invoke local --function server
# specify the route
sls invoke local --function server --data '{"pathParameters":{"route":"routeName"}}'
```