Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Nov 28, 2020. It is now read-only.
/MomentPublic archive

一瞬,记录美好瞬间。

License

NotificationsYou must be signed in to change notification settings

Innei/Moment

Repository files navigation

一瞬 (Moment),目的显而易见,就是希望它能够记录下生活中的美好瞬间。

后端正在测试和完善,咕咕咕咕

后端使用 Express + MongoDB 开发。

后端仓库地址:https://github.com/Innei/Moment-server

即刻体验:http://111.229.4.42/#/

后台: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

环境变量


[8]ページ先頭

©2009-2025 Movatter.jp