Skip to content

Commit

Permalink
feat(express): 新增使用教程等文档
Browse files Browse the repository at this point in the history
  • Loading branch information
142vip.cn committed Nov 14, 2023
1 parent 06b4a5c commit 4a53be9
Show file tree
Hide file tree
Showing 31 changed files with 1,037 additions and 267 deletions.
317 changes: 151 additions & 166 deletions README.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions code/docker/static-dist-deploy.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 设置基础镜像
FROM nginx:latest

# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面
COPY dist/ /usr/share/nginx/html/
# 用本地的 default.conf 配置来替换nginx镜像里的默认配置
COPY default.conf /etc/nginx/conf.d/default.conf
24 changes: 24 additions & 0 deletions code/nginx/static-dist-deploy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 部署前端构建后的dist静态文件
server {
listen 80;
server_name localhost;

#charset koi8-r;
access_log /var/log/nginx/host.access.log main;
error_log /var/log/nginx/error.log error;

location / {
# root 根目录,默认nginx镜像的html文件夹,可以指定其他
root /usr/share/nginx/html;
index index.html index.htm;
# 如果vue-router使用的是history模式,需要设置这个
try_files $uri $uri/ /index.html;
}

#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
14 changes: 14 additions & 0 deletions code/node/express/apps/quick-start/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const express = require('express')
const app = express()
const port = 3000

/**
* 基础API服务,Get类型
*/
app.get('/', (req, res) => {
res.send('Hello World!')
})

app.listen(port, () => {
console.log(`quick-start app listening on port ${port}`)
})
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4a53be9

Please sign in to comment.