Giter Club home page Giter Club logo

personal-web-frontend-react-portfolio's Introduction

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

DEVELOPMENT

  1. Set proxy, must to be a string in package.json file

  2. For example "proxy": "https://backend.example.com"

  3. Run project npm install && npm start || yarn install && yarn start

DEPLOYMENT

Set Proxy to deloy Heroku:

  1. When deploy on heroku, just push only package-lock.json or yarn.lock. Dont push both those files! npm install || yarn install

  2. Create static.json file { "root": "build/", "clean_urls": false, "routes": { "/": "index.html" }, "https_only": true, "headers": { "/": { "Strict-Transport-Security": "max-age=7776000" } }, "proxies": { "/api/": { "origin": "${API_URL}" } } }

  3. Push file to heroku git push heroku master

  4. Config proxy heroku All request from react contain "/api/abc" -> "/abc" For example: From react: axios.get("/api/search-items") โ†’ ${API_URL}/search-items
    From react: axios.get("/api/users/me") โ†’ ${API_URL}/users/me (!)Therefore, run this cmd to set proxy var in heroku: heroku config:set API_URL="https://backend.example.com/api"

personal-web-frontend-react-portfolio's People

Contributors

vuhuykhoi avatar

Watchers

 avatar

personal-web-frontend-react-portfolio's Issues

Load image

Image not load
=>fix

 class Foo extends React.Component {
  constructor(){
    super();
    this.state = {loaded: false};
  }

  render(){
    return (
      <div>
        {this.state.loaded ? null :
          <div
            style={{
              background: 'red',
              height: '400px',
              width: '400px',
            }}
          />
        }
        <img
          style={this.state.loaded ? {} : {display: 'none'}}
          src={this.props.src}
          onLoad={() => this.setState({loaded: true})}
        />
      </div>
    );
  }
}

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.