Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
Innei/Moment
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
一瞬 (Moment),目的显而易见,就是希望它能够记录下生活中的美好瞬间。
后端正在测试和完善,咕咕咕咕
后端使用 Express + MongoDB 开发。
后端仓库地址:https://github.com/Innei/Moment-server
后台:http://111.229.4.42/#/master
用户名:Innei
密码:qaz123..qqaa
preview:
以yarn
为例
cd# 构建前端git clone https://github.com/Innei/moment.gitcd momentyarn# 构建后端# 注意 您已正确安装了 redis 和 MongoDBcd git clone http://github.com/Innei/moment-server.gitcd moment-serveryarn
经过以上的步骤,已经正确的搭建完了主要的环境。接下你可以配合 nginx 等把该项目托管到网站上。
接下来,我会以 nginx 为例,简要的说明如何构建。
cd~/momentmkdir -p /home/wwwroot/wwwyarn build --moderncd~/moment-servercp .env.example .envyarn prod
通过以上的步骤已经把前端编译成静态页面,后端监听在本地 3000 端口上。使用yarn build --modern
可以编译一个速度更快,体积更小的仅支持现代浏览器的版本,你也可以去掉--modern
参数来编译一个兼容更多浏览器的版本。
接下来我们使用nginx
来启用反向代理,将/api
反向代理到本地的 3000 端口。
sudo vim /etc/nginx/sites-enabled/moment.conf
在该文件中写入
server {server_name example.com; #在这里输入你绑定的域名root /home/wwwroot/www;location / {try_files $uri $uri/ /index.html;}# 反代location /api {proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://127.0.0.1:3000;} # gzipgzip on;gzip_vary on;gzip_proxied any;gzip_comp_level 6;gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;}
nginx -s reload
即刻访问你的绑定的网址,开始初始化。
此项目使用 ES6 以及最新 CSS 规范编写,顾不支持旧版浏览器。
Chrome >= 76Firefox >= 70Safari >= 12etc.
接下来,我们来构建开发环境。
cd~/momentyarn serve.cd~/moment-serveryarn start
About
一瞬,记录美好瞬间。
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.