1. Create a database
Create DatabaseVueblog; Usevueblog;/* Create administrator table for background login, field for admin number (self-growth), account, password, logon time * /Create Table if not existsAdmin (IDintAuto_incrementPrimary Key, namevarchar( -) not NULL, Passwordvarchar( -) not NULL, Logintimevarchar( -) not NULL);
2. Create a project directory structure
1) initializing the project with VUE-CLI
# Global Installation vue-cli$ NPM install--global vue-cli# Create a new project based on Webpack template $ vue init webpack vue-blog# install dependent, walk you $ cd vue-blog$ CNPM install$ npm Run Dev
2) Create admin directory, store background related files
- Config to store the default file
- LIB to store operational database files
- Middlewares store to determine whether the file is logged
- Public Store style Files
- Routes Storing routing files
- Views Store template Files
- Index Program main file
3) Install the required modules in the background
Before installing we use CNPM installation
- -- registry=https://registry.npm.taobao.org
CNPM I koa koa-bodyparser koa-mysql-session koa-router koa-session-minimal koa-static koa-views MD5 moment MySQL Ejs--sav E
Use of each module
KOA Node Framework koa-bodyparser form parsing middleware koa-mysql-session, koa-session-minimal processing database middleware Koa-router Routing middleware koa-static Static resource loading middleware Ejs template engine MD5 password encryption moment time middleware MySQL database koa-views template rendering middleware
Vue+node+mysql Study Notes