File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import random
44
55from flask import Flask , jsonify , request
6+ from flask_cors import CORS
67
78from backend .blockchain .blockchain import Blockchain
89from backend .wallet .wallet import Wallet
1112from backend .pubsub import PubSub
1213
1314app = Flask (__name__ )
15+ CORS (app , resources = { r'/*' : { 'origins' : 'http://localhost:3000' } })
1416blockchain = Blockchain ()
1517wallet = Wallet (blockchain )
1618transaction_pool = TransactionPool ()
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import React , { useState , useEffect } from 'react' ;
2+ import logo from '../assets/logo.png' ;
3+
4+ function App ( ) {
5+ const [ walletInfo , setWalletInfo ] = useState ( { } ) ;
6+
7+ useEffect ( ( ) => {
8+ fetch ( 'http://localhost:5000/wallet/info' )
9+ . then ( response => response . json ( ) )
10+ . then ( json => setWalletInfo ( json ) ) ;
11+ } ) ;
12+
13+ return (
14+ < div className = "App" >
15+ < img className = "logo" src = { logo } alt = "application-logo" />
16+ < h3 > Welcome to pychain</ h3 >
17+ </ div >
18+ ) ;
19+ }
20+
21+ export default App ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import ReactDOM from 'react-dom' ;
33import './index.css' ;
4- import App from './App' ;
4+ import App from './components/ App' ;
55
66ReactDOM . render ( < App /> , document . getElementById ( 'root' ) ) ;
Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ Flask==1.1.1
33pubnub == 4.1.6
44requests == 2.22.0
55cryptography == 2.7
6+ Flask-Cors == 3.0.8
You can’t perform that action at this time.
0 commit comments