Commit 0f7668b7 authored by Navodya Pasqual's avatar Navodya Pasqual

Setting up proxy middleware

parent 9a80c43b
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -11,11 +11,19 @@ ...@@ -11,11 +11,19 @@
"react-scripts": "5.0.0", "react-scripts": "5.0.0",
"web-vitals": "^2.1.4", "web-vitals": "^2.1.4",
"axios": "^0.21.4", "axios": "^0.21.4",
"antd": "^3.26.5",
"prop-types": "^15.7.2",
"bootstrap": "^5.1.1", "bootstrap": "^5.1.1",
"react-bootstrap-validation": "^0.1.11", "react-bootstrap-validation": "^0.1.11",
"react-router-dom": "^5.3.0", "react-router-dom": "^5.3.0",
"react-redux": "^7.1.3",
"react-select": "^5.0.0", "react-select": "^5.0.0",
"react-validation": "^3.0.7" "react-speech-recognition": "^3.9.0",
"react-validation": "^3.0.7",
"redux": "^4.0.5",
"redux-promise": "^0.6.0",
"redux-thunk": "^2.3.0",
"uuid": "^3.3.2"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
...@@ -40,5 +48,8 @@ ...@@ -40,5 +48,8 @@
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
},
"devDependencies": {
"http-proxy-middleware": "^0.19.1"
} }
} }
import React, { useState, useEffect } from 'react';
import Axios from 'axios';
import { useDispatch, useSelector } from 'react-redux';
import { List, Icon, Avatar } from 'antd';
function DigitalHuman() {
return (
<div className='chat' >
Hi
</div>
)
}
export default DigitalHuman;
\ No newline at end of file
...@@ -2,13 +2,26 @@ import React from 'react'; ...@@ -2,13 +2,26 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import './index.css'; import './index.css';
import App from './App'; import App from './App';
import reportWebVitals from './reportWebVitals';
import "antd/dist/antd.css";
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import promiseMiddleware from 'redux-promise';
import ReduxThunk from 'redux-thunk';
import { BrowserRouter } from "react-router-dom";
const createStoreWithMiddleware = applyMiddleware(promiseMiddleware, ReduxThunk)(createStore);
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <Provider
<App /> store={createStoreWithMiddleware(
</React.StrictMode>,
window.__REDUX_DEVTOOLS_EXTENSION__ &&
window.__REDUX_DEVTOOLS_EXTENSION__()
)}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>,
document.getElementById('root') document.getElementById('root')
); );
reportWebVitals();
const proxy = require("http-proxy-middleware");
module.exports = function(app) {
app.use(proxy("/api", { target: "http://localhost:8081/" }));
};
...@@ -3,6 +3,7 @@ import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; ...@@ -3,6 +3,7 @@ import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
//import pages //import pages
import Home from "../main/home"; import Home from "../main/home";
import DigitalHuman from '../digitalHuman/digitalHuman';
function PageRoutes() { function PageRoutes() {
return ( return (
...@@ -11,6 +12,7 @@ function PageRoutes() { ...@@ -11,6 +12,7 @@ function PageRoutes() {
<section className="content"> <section className="content">
<Switch> <Switch>
<Route path="/" component={Home} exact/> <Route path="/" component={Home} exact/>
<Route path="/digital-human" component={DigitalHuman}/>
</Switch> </Switch>
</section> </section>
</Router> </Router>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment