Skip to content

Commit cc1c194

Browse files
committed
gitignore
1 parent 7218672 commit cc1c194

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
lib-cov
2+
*.seed
3+
*.log
4+
*.csv
5+
*.dat
6+
*.out
7+
*.pid
8+
*.gz
9+
*.idea
10+
11+
pids
12+
logs
13+
results
14+
15+
npm-debug.log
16+
node_modules

config/runtime.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
{
2-
2+
"db": {
3+
"USER": "test",
4+
"PASS": "test",
5+
"HOST": "localhost",
6+
"PORT": "",
7+
"DATABASE": "blog"
8+
}
39
}

controllers/CityController.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ CityController = function (app, mongoose, config) {
3333

3434
app.get('/city/loadCity/:index/?', function(req, res, next) {
3535
util.log(req.method + " request to url : " + req.route.path);
36+
var index = req.params.index;
3637
var query = City.find({}).sort({'createDate': -1}).skip(index).limit(30);
3738
query.execFind(function(err, cities) {
39+
console.log(cities)
3840
if (!err) {
39-
res.render('city-list', {
40-
title: "Cities",
41-
cities: cities,
42-
43-
});
41+
res.json(cities);
4442
} else {
4543
res.status(500);
4644
res.render('500', {

views/city-list.jade

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
!!! 5
22
html
33
head
4-
title City Database
4+
title #{title}
55
meta(name='viewport', content='width=device-width, initial-scale=1.0')
66
//
77
Bootstrap
@@ -77,7 +77,12 @@ html
7777
url: "/city/loadCity/"+lastCityIndex,
7878
success: function(html) {
7979
if (html) {
80-
$("tbody").append(html);
80+
var html_ = "";
81+
$.each(html, function(i, e) {
82+
html_ += '<tr cityindex="' + (i + lastCityIndex) + '"><td>' + e.city + '</td><td>' + e.loc + '</td><td>' + e.pop + '</td><td>' + e.dummy + '</td></tr>';
83+
});
84+
85+
$("tbody").append(html_);
8186
} else {
8287
alert("Error")
8388
}

0 commit comments

Comments
 (0)