This is the server part of FindMeConnectUs.
controllers
控制器目录api.js
RESTful API 业务逻辑
models
数据库模型定义目录app.js
Koa 应用启动文件controller.js
扫描并注册控制器db.js
定义数据库模型规范model.js
扫描并导入数据库模型package.json
npm 配置文件rest.js
支持 REST 的 Koa 中间件socket.js
Socket.IO 事件处理逻辑util.js
数据库交互封装
- MySQL Community Server v5.6.35
- Node.js v8.0.0 with npm v5.0.0
- Start your MySQL server
- Create an empty MySQL database (UTF-8 collation recommended)
- Create a file named
config.js
within this dir and input the following content
const config = {
dialect: "mysql",
database: "findmeconnectus", // your newly created database name
username: "root", // name of your MySQL user
password: "root", // password of the user
host: "localhost", // where your MySQL server runs
port: 3306 // the port your MySQL server listens
};
module.exports = config;
# install dependencies
npm install
# start server at localhost:3000
npm run start