41
loading...
This website collects cookies to deliver better user experience
assets/
directory from RGB GitHub repo into your rgb/
root directory. Beware that before starting server, you will have to run npm install
to install all packages required by React command, regardless of which approach you use.create-react-app
:cd ~/go/src/rgb
create-react-app assets
assets/
with all required setup for React app development. Important thing to do is to add "proxy": "http://localhost:8080"
inside of package.json
file. That will instruct React development server to proxy all our request to Gin backend which will be listening on port 8080.package.json
is "react-router-dom": "^5.2.0",
under dependencies
to add routing library. Your package.json
file should now look something like this (with maybe some different package versions):{
"name": "assets",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:8080",
"dependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
public/index.html
file:<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
assets/
directory. If you prefer to use some other framework or even pure Javscript, that's also possible since our Gin application doesn't care about frontend technology. This part is entirely up to you.npm start
.