Exploration of Thoughts: Express Tutorial 1 : Stock Market
WealthSimulator
In this project in which user can buy and sell stocks virtually.
Requirements
- Basic Javascript Knowledge
- Text editor
- Node js https://nodejs.org/en/download/
1. Setting up
- Create a Folder named "WealthSimulator"
- open Terminal or Powershell inside the Folder
- npm init -y // To Setup project
- npm install express
- Create a file server.js
server.jsimport express to your code
create instance of express
Our app will send 'Welcome' text as a response to request made with '/' in browser.
This will make app to listen to request at port
Now we are all set to run our server
Got to Terminal or power shell inside project foldernpm start
Cool Now, Our server is answering to request made by browser.
import express to your code
create instance of express
Our app will send 'Welcome' text as a response
to request made with '/' in browser.
This will make app to listen to request at port
Now we are all set to run our server
Got to Terminal or power shell inside project folder
npm start
Cool Now, Our server is answering to request made by browser.
2. Yahoo Finance API
npm install axios
Make account on Rapid API
On Endpoints Tab
Look for this in indices (left panel)
Copy The code snippet and paste it server.js
After
const app = express()
Before
app.get()
Delete import axios from "axios";
PUT const axios = require( "axios");
Now Run the Server
Check your Terminal or PowerShell
As we will move , we add following things in upcoming tutorials
- Templates
- Database
- User management System
Comments
Post a Comment