vue-koa-demo-master
所属分类:Node.js
开发工具:JavaScript
文件大小:142KB
下载次数:1
上传日期:2019-05-14 20:19:51
上 传 者:
最爱说谎的人
说明: 使用vue和koa进行网站设计,经实测,在云端和本地都可以使用
(Website design using Vue and KOA)
文件列表:
.babelrc (309, 2018-12-13)
.dockerignore (70, 2018-12-13)
.editorconfig (147, 2018-12-13)
.eslintrc.js (642, 2018-12-13)
.postcssrc.js (196, 2018-12-13)
.vscode (0, 2018-12-13)
.vscode\launch.json (1123, 2018-12-13)
.vscode\settings.json (59, 2018-12-13)
Dockerfile (66, 2018-12-13)
LICENSE (1077, 2018-12-13)
Vue+Koa.md (68116, 2018-12-13)
app.js (1715, 2018-12-13)
build (0, 2018-12-13)
build\build.js (953, 2018-12-13)
build\check-versions.js (1257, 2018-12-13)
build\dev-client.js (245, 2018-12-13)
build\dev-server.js (2444, 2018-12-13)
build\utils.js (1949, 2018-12-13)
build\vue-loader.conf.js (307, 2018-12-13)
build\webpack.base.conf.js (1616, 2018-12-13)
build\webpack.dev.conf.js (1225, 2018-12-13)
build\webpack.prod.conf.js (3742, 2018-12-13)
config (0, 2018-12-13)
config\dev.env.js (139, 2018-12-13)
config\index.js (1627, 2018-12-13)
config\prod.env.js (48, 2018-12-13)
docker-compose.yml (693, 2018-12-13)
env.js (135, 2018-12-13)
index.html (331, 2018-12-13)
init_db.sh (115, 2018-12-13)
mysql.dockerfile (418, 2018-12-13)
package.json (3770, 2018-12-13)
pm2.json (235, 2018-12-13)
server-entry.js (144, 2018-12-13)
server (0, 2018-12-13)
server\config (0, 2018-12-13)
server\config\db.js (395, 2018-12-13)
... ...
# vue-koa-demo
A fullstack demo used Vue2 & Koa2(Koa1 version is [here](https://github.com/Molunerfinn/vue-koa-demo/tree/koa1))
:sunny: Easy to setup and learn
:100: Api test coverage
:rocket: Instant feedback
:stuck_out_tongue_winking_eye: Vue SSR support in the [ssr](https://github.com/Molunerfinn/vue-koa-demo/tree/ssr) branch
:tada: Docker support
![Todolist](https://i.loli.net/2018/12/13/5c123b40a1baa.gif 'todolist')
View the [article](https://molunerfinn.com/Vue+Koa/) for more details.
If you want to check the info of the test, view the [article](https://molunerfinn.com/Use-Jest-To-Test-Vue-Koa/) for more details.
## Install
`git clone https://github.com/Molunerfinn/vue-koa-demo.git`
`npm install` or `yarn`
if you are using yarn & meet this error:
```bash
error upath@1.0.4: The engine "node" is incompatible with this module. Expected version ">=4 <=9".
```
please use
```
yarn --ignore-engines
```
Also you need to install MySQL & create a database named `todolist`,and execute 2 sql files `list.sql` & `user.sql`.They are in `sql/`
After that, create a `.env` file and set the database username & password:
```env
# your database username
DB_USER=XXXX
# your database
DB_PASSWORD=YYYY
# Koa is listening to this port
PORT=8889
```
If you want to run the test for the Project, please create a `.env.test` file to face this situation:
```env
# your database username
DB_USER=XXXX
# your database
DB_PASSWORD=YYYY
# The port which is listened by koa in the test environment
PORT=8888
```
### Run
> Node.js & Docker support. **You need to create a `.env` file as above**.
### Node.js
Beacuse of using Koa2, `Node.js >= v7.6.0` is needed.
#### Development:
`npm run dev` && `npm run server`
open browser: `localhost:8080`
> tips: login password is 123
#### Production:
`npm run start`
open browser: `localhost:8889`
> tips: login password is 123
#### Test:
`npm run test` and find the coverage report in the `coverage/lcov/index.html`
### Docker
`docker-compose build` && `docker-compose up`
> mysql in docker use 3306 port inside & outside.
open browser: `localhost:8889`
> tips: login password is 123
## License
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) 2017 Molunerfinn
近期下载者:
相关文件:
收藏者: