This is my Portfolio website, currently hosted on GitHub Pages, can be visited @ https://akverma26.github.io/.
Frontend is developed using ReactJS using following steps:
- Start with setting up the initial base and standard structure of the app by running the following command
npx create-react-app <directory>-
Clean up the project by removing not required files like
App.test.js,reportWebVitals.jsand changing some configurations -
Place all static text and data into
src/ProfileData.jsand use data from this file in React Components and Pages.
-
First add
"homepage": "builld/"key-value inpackage.json, now I just need to placebuild/index.htmlfile to the root directory of this project and this site can be served from rootindex.html(no need to copy all file frombuilddirectory to root directory to be served from root directory). Simply it's appendingbuild/to the path of all the files included inindex.html. -
Build the project using following command
npm run buildand then don't forget to copy build/index.html to index.html
React router urls won't directly means if your root url is https://somedomain.com then you can't access https://somedomain.com/some-page directly because React router works as client side router not as server side router.
For this simple hack is add "#" before all urls like this https://somedomain.com/#/some-page