Skip to content

Commit

Permalink
Share api document (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin authored Nov 1, 2022
1 parent 2a64e7d commit 0746c23
Show file tree
Hide file tree
Showing 160 changed files with 7,175 additions and 4,172 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules/
dist/
release/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
tests/**/coverage/

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln

.vercel
docker-compose.dev.yml
Dockerfile.dev
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Release

on:
push:
# branches: [for debug]
tags:
- 'v*.*.*'

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ Thumbs.db
# *-lock.json
-error.log
.vercel
nginx-test.conf
docker-compose.dev.yml
Dockerfile.dev
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# [1.9.0](https://github.com/eolinker/eoapi/compare/v1.8.2...v1.9.0) (2022-10-19)


### Features

* mock lead to download in web ([65c7ecf](https://github.com/eolinker/eoapi/commit/65c7ecffe795844fd24621c05e412a8af17eca09))



## [1.8.2](https://github.com/eolinker/eoapi/compare/v1.8.1...v1.8.2) (2022-10-18)


### Bug Fixes

* xml2json parser bug ([e2459a2](https://github.com/eolinker/eoapi/commit/e2459a23fc74a7696f5b6f3296c512d28939f6c7))


### Features

* keep queryParams stay in page ([baad303](https://github.com/eolinker/eoapi/commit/baad3038cbffd38cfea128f92d3cc3073a786e5a))



## [1.8.1](https://github.com/eolinker/eoapi/compare/v1.8.0...v1.8.1) (2022-10-13)


Expand Down
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM node:lts-alpine as builder

WORKDIR /test-server

# api 测试服务端口
ENV NODE_SERVER_PORT 4201
# websocket 测试服务端口
ENV EOAPI_WEBSOCKET_POST 4202

COPY /src/workbench/node /test-server

RUN yarn install

EXPOSE 4201 4202

CMD ["yarn", "start:all"]


FROM nginx:alpine as production

ENV NODE_ENV production

COPY ./src/workbench/browser/dist/ /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
39 changes: 39 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: '3'

services:
eoapi:
# build: 从当前路径构建镜像
build:
context: .
dockerfile: Dockerfile
target: production
image: eolinker/eoapi:1.9.0
container_name: eoapi
restart: always
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '8000:80'
networks:
- eoapi_net

eoapi-test-server:
# build: 从当前路径构建镜像
build:
context: .
dockerfile: Dockerfile
target: builder
image: eolinker/eoapi-test-server:1.9.0
container_name: eoapi-test-server
restart: always
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '4201:4201'
- '4202:4202'
networks:
- eoapi_net

networks:
eoapi_net:
name: eoapi_net
86 changes: 86 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen 80;
absolute_redirect off; #取消绝对路径的重定向
sendfile on;
default_type application/octet-stream;

gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;

root /usr/share/nginx/html;

location / {
return 301 $scheme://$http_host/zh;
}

location /zh {
alias /usr/share/nginx/html/zh;
index index.html index.htm;
try_files $uri $uri/ /zh/index.html;
}

location /en {
alias /usr/share/nginx/html/en;
index index.html index.htm;
try_files $uri $uri/ /en/index.html;
}

# api测试服务
location /api/unit {
proxy_pass http://eoapi-test-server:4201; # 转发规则
proxy_set_header Host $proxy_host; # 修改转发请求头,让3000端口的应用可以受到真实的请求
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

# websocket测试服务
location ~/socket.io/(.*) {
proxy_pass http://eoapi-test-server:4202; # 转发规则

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
}

# 后端服务
location ^~ /api {
proxy_pass http://eoapi-remote-server:3000; # 转发规则
proxy_set_header Host $proxy_host; # 修改转发请求头,让3000端口的应用可以受到真实的请求
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

# 后端服务兼容旧客户端
location ~ ^/(system|workspace|user|auth|[0-9]+/[0-9]+/api_data|[0-9]+/[0-9]+/group|[0-9]+/[0-9]+/group|[0-9]+/[0-9]+/environment|[0-9]+/[0-9]+/api_test_history|[0-9]+/[0-9]+/mock|[0-9]+/project) {
proxy_pass http://eoapi-remote-server:3000; # 转发规则
proxy_set_header Host $proxy_host; # 修改转发请求头,让3000端口的应用可以受到真实的请求
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

rewrite "^/(.*)$" /api/$1 break;
}

# location ^~ /zh/(.*)/assets/(.*)$ {
# alias /usr/share/nginx/html/zh/assets/$2;
# return 501 /usr/share/nginx/html/zh/assets/$2;
#}

# location ^~ /zh/\.(gif|jpg|jpeg|png|css|js|ico|svg|ttf|woff2|woff|txt)$ {
# alias /usr/share/nginx/html/zh/$1;
# return 502 /usr/share/nginx/html/zh/$1;
#}
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
"scripts": {
"postinstall": "electron-builder install-app-deps && npx patch-package",
"start": "npm-run-all -p start:workbench electron:serve",
"start:web": "cd src/workbench/browser && npm run ng:serve",
"start:testServer": "cd src/workbench/node/server && yarn dev",
"serve:web": "cd src/workbench/browser && npm run ng:serve",
"start:testServer": "cd src/workbench/node && yarn dev",
"start:workbench": "cd src/workbench/browser && yarn start",
"build:workbench": "cd src/workbench/browser && yarn build",
"docker:build:workbench": "cd src/workbench/browser && yarn build:docker:web",
"test:workbench": "cd src/workbench/browser && yarn test",
"electron:serve": "wait-on tcp:4200 && npm run electron:dev",
"electron:static": "npm run electron:tsc && electron .",
Expand Down Expand Up @@ -47,6 +48,7 @@
"express": "4.18.1",
"fix-path": "3.0.0",
"form-data": "^4.0.0",
"http-server": "14.1.1",
"iconv-lite": "^0.6.3",
"jquery": "^3.3.0",
"jsdom": "^11.5.1",
Expand Down
91 changes: 0 additions & 91 deletions src/app/electron-main/appView.ts

This file was deleted.

Loading

0 comments on commit 0746c23

Please sign in to comment.