GithubHelp home page GithubHelp logo

semekeng / aws-javascript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aaronwht/aws-javascript

0.0 0.0 1.0 437 KB

Deploy React to AWS S3 with CodePipeline - correlates with https://github.com/aaronwht/aws-javascript-api

CSS 5.90% JavaScript 93.92% HTML 0.18%

aws-javascript's Introduction

Deploy React to AWS

Deploy React to AWS

Overview

The code in this repository is configured to deploy to AWS S3 using AWS CodePipeline. The correlating server-side Node.js code may be found at https://github.com/aaronwht/aws-javascript-api.

Contact me if you run into problems using this repo or tutorial.

Correlating Video Tutorial

https://www.youtube.com/watch?v=sgBKkug6qsE

Running locally

Create an .env file in the root of your project as pictured below. As a convention, .env files store environment variables and are not checked into code repositories as they often include sensitive, or environment-related, information. This is typically done by including the .env file in your .gitignore file.

.env file

Create the variable REACT_APP_API and set it's value to http://localhost:8080/. (include the suffix slash) This will point to the correlating API endpoint specified above.

Run the below commands to install NPM packages locally and run the application.

npm install

npm start

The application should run locally.

The buildspec.yml file (code below) runs on the AWS build server.

version: 0.1
phases:
    install:
        commands:
        - npm install
        - npm run build
        - aws s3 cp build s3://$S3_BUCKET --recursive --exclude 'index.html'
        - aws s3 cp build/index.html s3://$S3_BUCKET

npm install installs NPM packages on the AWS build server.

npm run build creates a production version of the application on the AWS build server in the build folder.

aws s3 cp build uses the AWS CLI (which is automatically installed on the build server) to recursively copy the contents of the build folder to the AWS S3 bucket using the environment variable $S3_BUCKET. This environment variable's value is used by the AWS build pipeline.

If this helped you consider making a one time $1-$3 donation to support me at Patreon

aws-javascript's People

Contributors

aaronwht avatar

Forkers

ewanelvis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.