in.mov
- Node
- MySql
- ReactJs
References : Doc link
In this project, local database hosted on MySQL
server is used.
Database config:
HOST: "localhost"
USER: "root"
PASSWORD: "password"
DB: "stockdb"
dialect: "mysql"
Please make sure to have a local database named stockdb
and MySQL server to be running.
Useful commands:
export PATH=${PATH}:/usr/local/mysql/bin
mysql -u root -p
Start the backend express server:
cd backend/
npm install
node src/server.js
Start the frontend in the browser:
cd frontend/
npm install
npm start
You will see something like this:
-
Clone this repository
# Clone the repo git clone https://github.com/b18050/stock-market-price-explorer-Zenskar.git
-
Navigate into the folder
Navigate into your new site’s directory, install node modules and start it up:
cd stock-market-price-explorer-Zenskar/
You will see contents like this:
frontend backend README.md
-
Navigate into the frontend
cd frontend npm install npm start
-
Open the front end source code and start editing.
Your site is now running at
http://localhost:3000
!Open the
src
directory in your code editor of choice and edit away. Save your changes and the browser will update in real time!Folder structure (frontend) which are useful:
components services App.css
In services folder, you will find
stocks.js
file which contains code to fetch/post data from our backendMySQL
server. It usesaxios
forGET
,POST
operations.Example:
const getStocksSummary = async () => { const url = `${baseUrl}/summary` const response = await axios.get(url); return response.data; }
Inside
components
directory, one can find all the components used in the project.Main components are:
UserScreen AdminScreen
-
Navigate into the backend
cd backend npm install node src/server.js
-
Open the back end source code and start editing. Your site is now running at
http://localhost:8080
!Folder structure (backend) which are useful:
resources/uploads src/ config/ db.config.js controllers/ stock.controller.js middleware/ upload.js models/ index.js stock.model.js routes/ stock.routes.js server.js package.json