updated README of Web UI

added express-rate-limit middleware to Web UI
replaced href with ng-href in Admin UI

Merge branch 'develop'
pull/64/head
13621160019@163.com 2021-08-16 18:17:05 +08:00
commit 814f0a654b
4 changed files with 37229 additions and 3 deletions

View File

@ -116,7 +116,7 @@
<tbody>
<tr ng-repeat="costfile in costfiles">
<td class="text-center">{{ costfile.id }}</td>
<td class="text-center"><a href="./upload/{{costfile.uuid}}"
<td class="text-center"><a ng-href="./upload/{{costfile.uuid}}"
download="{{costfile.file_name}}">{{ costfile.file_name }}</a>
</td>
<td class="text-center">{{ costfile.status }}</td>

30
web/README.md vendored
View File

@ -13,7 +13,35 @@ nginx-1.18.0 or later
## Running in Local environment
This project is scaffolded using Create React App.
* Install Node.js (https://nodejs.org/) if you do not already have it installed on your machine.
* Install Node.js via binary archive on Linux
Download Current Linux Binaries (x64) from https://nodejs.org/en/download/current/
Unzip the binary archive to /usr/local/bin/nodejs,
```
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-v1x.x.x-linux-x64.tar.xz -C /usr/local/lib/nodejs
```
Using sudo to symlink node, npm, and npx into /usr/bin/:
```
sudo ln -s /usr/local/lib/nodejs/node-v1x.x.x-linux-x64/bin/node /usr/bin/node
```
```
sudo ln -s /usr/local/lib/nodejs/node-v1x.x.x-linux-x64/bin/npm /usr/bin/npm
```
```
sudo ln -s /usr/local/lib/nodejs/node-v1x.x.x-linux-x64/bin/npx /usr/bin/npx
```
Test installation using
```
node -v
```
```
npm version
```
```
npx -v
```
* Open the “myems/web” directory with your cmd or terminal
* Run 'sudo npm i --unsafe-perm=true --allow-root'
This command will download all the necessary dependencies for falcon in the node_modules directory.

37189
web/package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

11
web/server.js vendored
View File

@ -1,11 +1,20 @@
const compression = require('compression');
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const app = express();
app.use(compression());
app.disable('x-powered-by');
app.use(express.static(path.join(__dirname, 'build')));
// set up rate limiter: maximum of five requests per minute
var RateLimit = require('express-rate-limit');
var limiter = new RateLimit({
windowMs: 1*60*1000, // 1 minute
max: 5 // limit each IP to 5 requests per windowMs
});
// apply rate limiter to all requests
app.use(limiter);
// need to declare a "catch all" route on your express server
// that captures all page requests and directs them to the client
// the react-router do the route part