Skip to content

Commit 4a53be9

Browse files
author
142vip.cn
committed
feat(express): 新增使用教程等文档
1 parent 06b4a5c commit 4a53be9

File tree

31 files changed

+1037
-267
lines changed

31 files changed

+1037
-267
lines changed

README.md

Lines changed: 151 additions & 166 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 设置基础镜像
2+
FROM nginx:latest
3+
4+
# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面
5+
COPY dist/ /usr/share/nginx/html/
6+
# 用本地的 default.conf 配置来替换nginx镜像里的默认配置
7+
COPY default.conf /etc/nginx/conf.d/default.conf

code/nginx/static-dist-deploy.conf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# 部署前端构建后的dist静态文件
2+
server {
3+
listen 80;
4+
server_name localhost;
5+
6+
#charset koi8-r;
7+
access_log /var/log/nginx/host.access.log main;
8+
error_log /var/log/nginx/error.log error;
9+
10+
location / {
11+
# root 根目录,默认nginx镜像的html文件夹,可以指定其他
12+
root /usr/share/nginx/html;
13+
index index.html index.htm;
14+
# 如果vue-router使用的是history模式,需要设置这个
15+
try_files $uri $uri/ /index.html;
16+
}
17+
18+
#error_page 404 /404.html;
19+
# redirect server error pages to the static page /50x.html
20+
error_page 500 502 503 504 /50x.html;
21+
location = /50x.html {
22+
root /usr/share/nginx/html;
23+
}
24+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const express = require('express')
2+
const app = express()
3+
const port = 3000
4+
5+
/**
6+
* 基础API服务,Get类型
7+
*/
8+
app.get('/', (req, res) => {
9+
res.send('Hello World!')
10+
})
11+
12+
app.listen(port, () => {
13+
console.log(`quick-start app listening on port ${port}`)
14+
})
37.6 KB
Loading
46.2 KB
Loading
9.18 KB
Loading

0 commit comments

Comments
 (0)