diff --git a/net/container/Dockerfile b/net/container/Dockerfile index 47db3458..368afa28 100644 --- a/net/container/Dockerfile +++ b/net/container/Dockerfile @@ -19,9 +19,14 @@ RUN apt-get -y install imagemagick-6.q16 RUN apt-get -y install ffmpeg RUN apt-get -y install build-essential RUN apt-get -y install sqlite3 +RUN apt-get -y install npm RUN apt-get -y upgrade +RUN npm install --global yarn +RUN npm install -g n +RUN n stable + RUN wget https://go.dev/dl/go1.17.5.linux-amd64.tar.gz RUN tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz diff --git a/net/server/internal/routers.go b/net/server/internal/routers.go index 1da17cbc..c3e85261 100644 --- a/net/server/internal/routers.go +++ b/net/server/internal/routers.go @@ -43,8 +43,8 @@ func NewRouter() *mux.Router { Handler(handler) } - fs := http.FileServer(http.Dir("./")) - router.PathPrefix("/static").Handler(http.StripPrefix("/", fs)) + fs := http.FileServer(http.Dir("/data/web/")) + router.PathPrefix("/").Handler(http.StripPrefix("/", fs)) return router } @@ -54,12 +54,6 @@ func Index(w http.ResponseWriter, r *http.Request) { } var routes = Routes{ - Route{ - "Index", - "GET", - "/", - Index, - }, Route{ "AddAccount", diff --git a/net/web/package.json b/net/web/package.json new file mode 100644 index 00000000..2aafbb47 --- /dev/null +++ b/net/web/package.json @@ -0,0 +1,38 @@ +{ + "name": "antd-demo", + "version": "0.1.0", + "private": true, + "dependencies": { + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^12.0.0", + "@testing-library/user-event": "^13.2.1", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "react-scripts": "5.0.0", + "web-vitals": "^2.1.0" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/net/web/public/favicon.ico b/net/web/public/favicon.ico new file mode 100644 index 00000000..a11777cc Binary files /dev/null and b/net/web/public/favicon.ico differ diff --git a/net/web/public/index.html b/net/web/public/index.html new file mode 100644 index 00000000..aa069f27 --- /dev/null +++ b/net/web/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + React App + + + +
+ + + diff --git a/net/web/public/logo192.png b/net/web/public/logo192.png new file mode 100644 index 00000000..fc44b0a3 Binary files /dev/null and b/net/web/public/logo192.png differ diff --git a/net/web/public/logo512.png b/net/web/public/logo512.png new file mode 100644 index 00000000..a4e47a65 Binary files /dev/null and b/net/web/public/logo512.png differ diff --git a/net/web/public/manifest.json b/net/web/public/manifest.json new file mode 100644 index 00000000..080d6c77 --- /dev/null +++ b/net/web/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/net/web/public/robots.txt b/net/web/public/robots.txt new file mode 100644 index 00000000..e9e57dc4 --- /dev/null +++ b/net/web/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/net/web/src/App.css b/net/web/src/App.css new file mode 100644 index 00000000..74b5e053 --- /dev/null +++ b/net/web/src/App.css @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/net/web/src/App.js b/net/web/src/App.js new file mode 100644 index 00000000..37845757 --- /dev/null +++ b/net/web/src/App.js @@ -0,0 +1,25 @@ +import logo from './logo.svg'; +import './App.css'; + +function App() { + return ( +
+
+ logo +

+ Edit src/App.js and save to reload. +

+ + Learn React + +
+
+ ); +} + +export default App; diff --git a/net/web/src/App.test.js b/net/web/src/App.test.js new file mode 100644 index 00000000..1f03afee --- /dev/null +++ b/net/web/src/App.test.js @@ -0,0 +1,8 @@ +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/net/web/src/index.css b/net/web/src/index.css new file mode 100644 index 00000000..ec2585e8 --- /dev/null +++ b/net/web/src/index.css @@ -0,0 +1,13 @@ +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} diff --git a/net/web/src/index.js b/net/web/src/index.js new file mode 100644 index 00000000..ef2edf8e --- /dev/null +++ b/net/web/src/index.js @@ -0,0 +1,17 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.css'; +import App from './App'; +import reportWebVitals from './reportWebVitals'; + +ReactDOM.render( + + + , + document.getElementById('root') +); + +// If you want to start measuring performance in your app, pass a function +// to log results (for example: reportWebVitals(console.log)) +// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals +reportWebVitals(); diff --git a/net/web/src/logo.svg b/net/web/src/logo.svg new file mode 100644 index 00000000..9dfc1c05 --- /dev/null +++ b/net/web/src/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/net/web/src/reportWebVitals.js b/net/web/src/reportWebVitals.js new file mode 100644 index 00000000..5253d3ad --- /dev/null +++ b/net/web/src/reportWebVitals.js @@ -0,0 +1,13 @@ +const reportWebVitals = onPerfEntry => { + if (onPerfEntry && onPerfEntry instanceof Function) { + import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + getCLS(onPerfEntry); + getFID(onPerfEntry); + getFCP(onPerfEntry); + getLCP(onPerfEntry); + getTTFB(onPerfEntry); + }); + } +}; + +export default reportWebVitals; diff --git a/net/web/src/setupTests.js b/net/web/src/setupTests.js new file mode 100644 index 00000000..8f2609b7 --- /dev/null +++ b/net/web/src/setupTests.js @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom';