更新readme
parent
c9d1939502
commit
d350745299
40
Readme.md
40
Readme.md
|
@ -1,10 +1,17 @@
|
|||
# Five.js(node-five)
|
||||
|
||||
![give me five](http://attach.cdn.doui.cc/apps/five.jpg)
|
||||
```
|
||||
____ _ __ _
|
||||
/ ___(_)_ _____ _ __ ___ ___ / _(_)_ _____
|
||||
| | _| \ \ / / _ \ | '_ ` _ \ / _ \ | |_| \ \ / / _ \
|
||||
| |_| | |\ V / __/ | | | | | | __/ | _| |\ V / __/
|
||||
\____|_| \_/ \___| |_| |_| |_|\___| |_| |_| \_/ \___|
|
||||
|
||||
```
|
||||
|
||||
一个轻量级的,易学的,拓展性灵活的 nodejs MVC 框架, 5 分钟即可上手。取自"Give me five"之意, 一切就是这么简单
|
||||
|
||||
该分支要求 nodejs 版本在 7.0 或以上,默认使用 mongoDB/MySQL,其他的数据库可以自行拓展
|
||||
框架要求 nodejs 版本在 12.0 或以上, 并且只支持使用`import/export`
|
||||
|
||||
## 启用方法(步骤)
|
||||
|
||||
|
@ -18,7 +25,7 @@
|
|||
|
||||
```bash
|
||||
# 全局安装 five-cli
|
||||
sudo npm i five-cli -g
|
||||
npm i -g @gm5/cli
|
||||
|
||||
# 进入项目目录
|
||||
cd /project/demo
|
||||
|
@ -34,11 +41,16 @@ five-cli start
|
|||
# 进入项目目录
|
||||
cd /project/demo
|
||||
|
||||
npm i node-five --save
|
||||
npm i @gm5/core
|
||||
mkdir apps public data views
|
||||
|
||||
touch app.js
|
||||
# 自行编辑app.js, 然后通过node, pm2启动项目即可
|
||||
#
|
||||
# import Five from '@gm5/core'
|
||||
# var app = new Five()
|
||||
# app.repload('./apps')
|
||||
# app.listen(8000)
|
||||
|
||||
```
|
||||
|
||||
|
@ -50,19 +62,21 @@ touch app.js
|
|||
```javascript
|
||||
'use strict'
|
||||
|
||||
const Five = require('five')
|
||||
const app = new Five()
|
||||
import Five from '@gm5/core'
|
||||
|
||||
var app = new Five()
|
||||
|
||||
app.set({ website: 'www.your_domain.com' })
|
||||
app.set({ domain: 'your_domain.com' }) // 设置域,cookie用到,不设置则同步website
|
||||
|
||||
app.set({ VIEWS: './views/' }) // [可选], 但是要用到模板渲染页面时, 必须指定
|
||||
|
||||
app.preload('./apps/') // [必须], 预加载应用目录
|
||||
|
||||
app.listen(3001) // 默认是3000
|
||||
```
|
||||
|
||||
其他的配置, 请参考 `文档(全局配置)` 一节
|
||||
其他的配置和功能, 请参考 `文档`。
|
||||
|
||||
|
||||
3. 启动应用。在项目根目录打开终端, 输入以下命令 `five-cli start`, 然后根据提示操作, 即可
|
||||
|
@ -82,19 +96,19 @@ pm2 start app.js
|
|||
|
||||
```nginx
|
||||
upstream five_upstream {
|
||||
server 127.0.0.1:3000;
|
||||
#server 127.0.0.1:3005;
|
||||
server 127.0.0.1:3001;
|
||||
#server 127.0.0.1:3002;
|
||||
keepalive 64;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
server_name doui.cc;
|
||||
server_name abc.com;
|
||||
index index.html index.htm;
|
||||
root /www/doui.cc/public;
|
||||
root /www/abc.com/public;
|
||||
|
||||
location ~ ^/(images/|js/|css/|cache/|favicon.ico|robots.txt) {
|
||||
location ~ ^/(images/|js/|css/|upload/|favicon.ico|robots.txt) {
|
||||
expires 1d;
|
||||
access_log off;
|
||||
}
|
||||
|
@ -123,7 +137,7 @@ server {
|
|||
|
||||
|
||||
|
||||
5. Enjoy you web
|
||||
5. 请开始你的表演。
|
||||
|
||||
## 版权说明
|
||||
|
||||
|
|
Loading…
Reference in New Issue