GithubHelp home page GithubHelp logo

ucsb-cs156-s23 / demo-react-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.83 MB

Home Page: https://ucsb-cs156-s23.github.io/demo-react-example/

License: MIT License

JavaScript 89.52% HTML 9.00% CSS 1.49%

demo-react-example's Introduction

demo-react-example

This repo is a cousin of demo-spring-react-example

It was produced by starting with demo-spring-react-example, removing all of the Spring Boot backend code, leaving only a React app, and then adapting that React app so that it would run on GitHub pages, using the techniques described in this repo:

A pure React app has no backend, so it can only compute using what the user types in or uploads, and storage is limited.

One kind of storage it can use is "local storage", which is a key/value store that is located on the client machine, and associated with a specific browser (it is not shared across browsers.)

Storybook

Storybook is here:

The GitHub actions script to deploy the Storybook to QA requires some configuration; see docs/github-actions.md for details.

If these repos are not yet setup, see the setup steps in docs/storybook.md.

Getting Started on localhost

cd frontend
npm install  # only on first run or when dependencies change
npm start

Then, the app should be available on http://localhost:3000

Getting Started on GitHub Pages

Edit the frontend/package.json file to change this entry:

  "homepage": "https://ucsb-cs156.github.io/demo-react-example",

To one that matches the GitHub organization or user for your repo, for example

  • Using the Heroku CLI:
    heroku config:set PRODUCTION=true --app <heroku app name>
    
  • Or set it on the Heroku Dashboard: image

You'll also need to follow the OAuth set up instructions here: docs/oauth.md.

If you get the following message on Heroku, it probably means that you failed to setup the PRODUCTION environment variable.

Failed to connect to the frontend server... On Heroku, be sure that PRODUCTION is defined.  On localhost, open a second terminal window, cd into frontend and type: npm install; npm start";

Accessing swagger

To access the swagger API endpoints, use:

To run React Storybook

SQL Database access

On localhost:

  • The SQL database is an H2 database and the data is stored in a file under target
  • Each time you do mvn clean the database is completely rebuilt from scratch
  • You can access the database console via a special route, http://localhost:8080/h2-console
  • For more info, see docs/h2-database.md

On Heroku:

  • The SQL database is a postgres database provisioned automatically by Heroku
  • You can reset it with heroku pg:reset --app app-name-goes-here
  • More info and instructions for access the SQL prompt are at docs/postgres-database.md

demo-react-example's People

Contributors

pconrad avatar

Watchers

Avishek De avatar

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.