Skip to content

Commit 699e68a

Browse files
committed
v0.0.1
1 parent 4aeb14a commit 699e68a

26 files changed

+422
-146
lines changed

.DS_Store

6 KB
Binary file not shown.

Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#设置基础镜像,如果本地没有该镜像,会从daocloud.io服务器pull镜像
2+
FROM daocloud.io/node:latest
3+
4+
#创建app目录,保存我们的代码
5+
RUN mkdir -p /usr/src/node
6+
#设置工作目录
7+
WORKDIR /usr/src/node
8+
9+
#复制所有文件到 工作目录。
10+
COPY . /usr/src/node
11+
12+
#编译运行node项目,使用npm安装程序的所有依赖,利用taobao的npm安装
13+
14+
WORKDIR /usr/src/node/website
15+
RUN npm install --registry=https://registry.npm.taobao.org
16+
17+
#暴露container的端口
18+
EXPOSE 3000
19+
20+
#运行命令
21+
cmd ["npm","start"]

app.js

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var login = require('./routes/login');
1515
var editor = require('./routes/editor');
1616
var register = require('./routes/register');
1717
var dashboard = require('./routes/dashboard');
18+
var article = require('./routes/article');
1819

1920
var app = express();
2021

@@ -55,6 +56,7 @@ app.use('/login', login);
5556
app.use('/editor', editor);
5657
app.use('/register', register);
5758
app.use('/dashboard', dashboard);
59+
app.use('/article',article);
5860

5961
// catch 404 and forward to error handler
6062
app.use(function(req, res, next) {
+11-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
module.exports = {
2-
list: function(req, res, next) {
3-
req.models.articles.find().limit(5).all(function(err, articles) {
2+
list: function(req, res, next, offset) {
3+
console.log(offset);
4+
req.models.articles.find().order("createdate","Z").offset(offset*3).limit(3).all(function(err, articles) {
5+
46
if (err)
57
return next(err);
68

79
var items = articles.map(function(m) {
8-
// if (!m.path) {
9-
// var key = m.filename;
10-
// m.path = policy.makeRequest(link + key);
11-
// }
12-
// console.log(m.path);
1310
return m.serialize();
1411
});
1512
console.log(items);
1613

1714
res.send({items: items});
1815
});
16+
},
17+
count: function(req, res, next) {
18+
req.models.articles.count(function(err, size) {
19+
if (err)
20+
return next(err);
21+
res.send({count: size,index:0});
22+
});
1923
}
2024
}

app/models/articles.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ module.exports = function(orm, db) {
66
},
77
headline: String,
88
subtitle: String,
9+
summary: String,
910
filename: String,
1011
imgpath: String,
1112
createdate: String,
12-
lasteditdate: String
13+
lasteditdate: String,
14+
tags: String,
15+
guid: String
1316
}, {
1417
methods: {
1518
serialize: function() {
@@ -27,10 +30,13 @@ module.exports = function(orm, db) {
2730
id: this.id,
2831
headline: this.headline,
2932
subtitle: this.subtitle,
33+
summary: this.summary,
3034
filename: this.filename,
3135
imgpath: this.imgpath,
3236
createdate: this.createdate,
33-
lasteditdate: this.lasteditdate
37+
lasteditdate: this.lasteditdate,
38+
tags: this.tags,
39+
guid: this.guid
3440
};
3541
}
3642
}

app/models/users.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = function(orm, db) {
2-
var users = db.define("user", {
2+
var users = db.define("users", {
33
id: {
44
type: 'serial',
55
key: true

config/settings.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ var settings = {
44
query: {
55
pool: true
66
},
7-
host: "localhost",
8-
port: '3306',
9-
database: "blog",
10-
user: "root",
11-
password: "123456"
7+
8+
// host: "localhost",
9+
// port: '3306',
10+
// database: "blog",
11+
// user: "root",
12+
// password: "123456"
1213
}
1314
};
1415

config/webpack.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ var webpack = require('webpack');
33
module.exports = {
44
entry: {
55
markdown:'./react/markdown.js',
6-
article_preview:'./react/article_preview.js'
6+
article_preview:'./react/article_preview.js',
7+
tag:'./react/tag.js'
78
},
89
output: {
910
path: __dirname + '/static',

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"jade": "~1.11.0",
1414
"morgan": "~1.8.1",
1515
"serve-favicon": "~2.4.2",
16-
"marked":"latest",
16+
"marked":"0.3.6",
1717
"react": "~15.5.4",
1818
"react-dom": "~15.5.4",
1919
"webpack": "~2.4.1",
@@ -27,6 +27,9 @@
2727
"mysql":"~2.13.0",
2828
"moment":"~2.18.1",
2929
"qiniu":"~6.1.13",
30-
"react-fileupload":"~2.4.0"
30+
"react-fileupload":"~2.4.0",
31+
"jsonwebtoken":"~7.4.1",
32+
"uuid":"~3.0.1",
33+
"forever-monitor":"~1.7.1"
3134
}
3235
}

public/stylesheets/markdownEditor.css

+25
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,28 @@
2222
html, body {
2323
height: 100%;
2424
}
25+
26+
ul .tag {
27+
background-color: #f1f8ff;
28+
padding-left: 9.6px;
29+
margin-right: 4.8px;
30+
margin-top: 10px;
31+
}
32+
33+
ul .tag button {
34+
background-color: #f1f8ff;
35+
border-top: 0px;
36+
border-right: 0px;
37+
border-bottom: 0px;
38+
border-left: 1px solid #b4d9ff;
39+
margin-left: 8px;
40+
outline: none;
41+
}
42+
43+
ul .tag button:hover {
44+
background-color: #ddeeff;
45+
}
46+
47+
ul li input:focus {
48+
outline: none;
49+
}

public/stylesheets/style.css

+33-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,45 @@
11
body {
2-
padding: 50px;
3-
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4-
background-color: rgb(235, 235, 235);
2+
padding: 50px;
3+
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4+
background-color: rgb(235, 235, 235);
55
}
66

77
a {
8-
color: #00B7FF;
8+
color: black;
99
}
10+
11+
a:hover {
12+
color: black;
13+
text-decoration: none;
14+
}
15+
16+
1017
p {
11-
word-break:break-word;
18+
word-break: break-word;
1219
}
20+
1321
.article-preview {
14-
padding: 50px;
15-
background-color: white;
16-
margin-bottom: 50px;
22+
padding: 30px;
1723
}
1824

1925
.content img {
20-
width: 300px;
21-
height: 300px;
26+
width: 300px;
27+
height: 300px;
28+
}
29+
30+
#floor {}
31+
32+
#floor li {
33+
list-style-type: none;
34+
display: list-item;
35+
}
36+
37+
#floor li a {
38+
color: #b8c4cc;
39+
border-radius: 0px;
40+
}
41+
42+
#floor li.active a {
43+
background-color: white;
44+
color: black;
2245
}

react/article_preview.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ var React = require('react');
22
var ReactDom = require('react-dom');
33
var Preview = require('./components/article_preview.jsx');
44

5-
ReactDom.render(<Preview promise={$.getJSON('/getArticle')}/>,document.getElementById('content'));
5+
ReactDom.render(<Preview promise={$.getJSON('/getArticleSize')}/>,document.getElementById('content'));

0 commit comments

Comments
 (0)