Skip to content

Latest commit

 

History

History
150 lines (113 loc) · 3.16 KB

README.md

File metadata and controls

150 lines (113 loc) · 3.16 KB

stock-market-price-explorer-Zenskar

in.mov

Dependencies :

  • Node
  • MySql
  • ReactJs

Resources used :

References : Doc link

🚀 Quick start

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: Screenshot 2022-10-16 at 3 45 59 PM

🧐 Quick brief about the codebase

  1. Clone this repository

    # Clone the repo
    git clone https://github.com/b18050/stock-market-price-explorer-Zenskar.git
  2. 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
  3. Navigate into the frontend

    cd frontend
    npm install
    npm start
  4. 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 backend MySQL server. It uses axios for GET, 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
  5. Navigate into the backend

    cd backend
    npm install
    node src/server.js
  6. 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