Skip to content

andrebonna/express-serverless-react

Repository files navigation

Express-Serverless with Universal React Template

Hybrid NodeJS Server/Serverless API/Universal-React architecture Template. Code your API handlers using AWS Lambda syntax and bind your endpoints in serverless.yml. Since it's a NodeJS project, you can install any lib you want.

Run it anywhere!

Requirements

Create new API endpoints

Inside src/Serverless folder you will find all files containing AWS Lambda functions. Inside src/View folder you will find React files. There is a GET/POST example with a dumb authorizer step. The GET returns a page with universal-react. Following serverless framework you can configure new endpoints in serverless.yml

Environment Variables

NODE_ENV: # Define your deployment environment (e.g. production)
STATIC_PATH: # Define CDN root path (AWS S3 bucket URL)
DYNAMODB_TABLE: # Name of dynamoDB photos table
BUCKET_NAME: # Define AWS S3 bucket name

Deploy Client Template to S3 Bucket

BUCKET_NAME=<your-bucket-name> npm run deploy:client

Deploy Backend Template as Serverless

STATIC_PATH=<path-to-your-s3-bucket> DYNAMODB_TABLE=<name-of-dynamoDB-table> npm run deploy:backend

Run Template on a local server

npm install
npm start

Run Template as a docker container

docker build -t express-serverless .
docker run -p 3000:3000 express-serverless

Run server for development purposes

npm run dev:server

Run webpack client for development purposes

npm run dev:client

Run Unit Tests

npm install
npm test

About

Hybrid NodeJS Server/Serverless API architecture and React Client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •