This project was bootstrapped with Create React App.
Build this app into an OCI image using the Paketo Node.js and a web server
buildpack (either HTTPD or NGINX). There are two project
descriptor
files in this directory, httpd.toml
and nginx.toml
. Each contain the
configuration necessary to build the React source code into static assets and
serve those assets with the selected server.
The HTTPD and NGINX buildpacks will automatically generate a default configuration file for the server.
pack build react-sample --descriptor httpd.toml
pack build react-sample --descriptor nginx.toml
docker run -it -p 8080:8080 --env PORT=8080 react-sample
Visit localhost:8080
in your browser. Since push-state routing is enabled in
this build with BP_WEB_SERVER_ENABLE_PUSH_STATE
, visiting
localhost:8080/foo
– or any other endpoint – will serve the same page.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.