Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
fengdebing committed Apr 6, 2018
0 parents commit e5702b6
Show file tree
Hide file tree
Showing 18 changed files with 831 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
node_modules/
22 changes: 22 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const Koa = require('koa');
const app = new Koa();
const router = require('./routes/main');
// const path = require('path');
const server = require('koa-static2');
// const views = require('koa-views');

// 静态资源目录对于相对入口文件index.js的路径
const staticPath = './public';
app.use(server(staticPath));


// 加载模板引擎
// app.use(views(path.join(__dirname, './public/views'), {
// extension: 'ejs'
// }));


app.use(router.routes())
.use(router.allowedMethods());
app.listen(3000);
console.log('[demo] start-quick is starting at port 3000');
30 changes: 30 additions & 0 deletions app/Controller/PostController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
let DB = require('./../../utils/dbUtil');

const PostController = {

async getList (ctx) {
// let list = DB.select('posts','*');
// ctx.body = ;
ctx.body = await DB.select('posts','*') ;
},

async create () {

},

async update () {

},

async find () {

},

async del () {

},

};


module.exports = PostController;
15 changes: 15 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const config = {

port: 3001,

database: {
DATABASE: 'omblog_v2',
USERNAME: 'root',
PASSWORD: 'root',
PORT: '3306',
HOST: 'localhost',
prefix: 'om_'
}
};

module.exports = config;
12 changes: 12 additions & 0 deletions database/categories.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"id": 1,
"p_id": 0,
"name": "类别名称"
},
{
"id": 2,
"p_id": 1,
"name": "类别名称"
}
]
15 changes: 15 additions & 0 deletions database/posts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"id": 1,
"title": "标题",
"content": "内容详情",
"desc": "描述",
"u_id": "提交的用户",
"category_id": "所属目录",
"tags": [],
"type": "默认是0 只有后台可见,发布后1 删除 2",
"published_at": "发布时间",
"created_at": "创建时间",
"deleted_at": "删除时间"
}
]
7 changes: 7 additions & 0 deletions database/tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"id": 1,
"tag_name": "javascript",
"tag_desc": "描述"
}
]
6 changes: 6 additions & 0 deletions database/tasg.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS `user_info` (
`id` int(11) NOT NULL AUTO_INCREMENT, # 标签ID
`tag_name` varchar(255) NOT NULL, # 标签名称
`tag_desc` varchar(255) DEFAULT '', # 标签描述
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
9 changes: 9 additions & 0 deletions database/users.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"id": 1,
"email": "email",
"username": "fdb",
"password": "密码",
"avatar": ""
}
]
10 changes: 10 additions & 0 deletions database/users.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS `user_info` (
`id` int(11) NOT NULL AUTO_INCREMENT, # 用户ID
`email` varchar(255) NOT NULL, # 邮箱地址
`password` varchar(255) NOT NULL, # 密码
`nickname` varchar(255) DEFAULT NULL, # 用户昵称
`detail_info` longtext DEFAULT NULL, # 详细信息
`created_at` int(11) DEFAULT NULL, # 创建时间
`modified_at` int(11) DEFAULT NULL, # 修改时间
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Loading

0 comments on commit e5702b6

Please sign in to comment.