Skip to content

Latest commit

 

History

History
81 lines (49 loc) · 1.65 KB

README.md

File metadata and controls

81 lines (49 loc) · 1.65 KB

react-template

This is a starting webpack template for a ReactJS project.

Usage

Installing all the dependencies:

npm install

Checking if some updates are available (I use npm-check-updates):

npm run update

Install updates:

npm run install

Build for production:

npm run build

Watch for developement:

npm run watch

Developement web server:

python3 -m http.server
curl http://0.0.0.0:5000/

Usage

npm install
npm run update
npm run build
npm run watch
npm run serve

The developement server runs with "serve".

Proxy dev server

I usually have a Python application server do serve APIs. In this case it is necessary to setup a proxy configuration for Parcel, in order to dispatch some API calls to the developement server.

I define a .proxyrc.json file in this way (documentation):

{
    "/api": {
        "target": "http://dev:8000/",
        "pathRewrite": {
            "^/api": "/api"
        }
    }
}

In the sample above, all API calls starting with /api are redirected to something running on another port (also another domain).

Usage

npm install
npm run update
npm run build
npm run serve

The developement server runs with "serve".

Server Docker

Here I have a simple Python3/Sanic web server.

sudo docker run --rm -it -p 5000:8000 -d bacchilu/sanic-app

curl http://0.0.0.0:5000/json