-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathphantomjs.js
More file actions
33 lines (24 loc) · 791 Bytes
/
phantomjs.js
File metadata and controls
33 lines (24 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
process.env.NODE_ENV = 'production';
var config = require(__dirname + '/server/config/config'),
mongoose = require('mongoose'),
db = mongoose.connect(config.db),
mongoose = require('mongoose'),
post = require(config.sroot + '/models/post'),
Post = mongoose.model('Post'),
snapshots = require(__dirname + '/server/utils/snapshots'),
_ = require('lodash');
snapshots();
snapshots('/blog');
Post.find({status:'publish',published:{$lt : Date.now()}}).sort('-published').exec(function(err, posts) {
if (err) {
console.log(err);
return;
}
_.forEach(posts,function(post) {
snapshots('/blog/'+post._id+'/'+post.slug);
console.log('/blog/'+post._id+'/'+post.slug);
});
});
post = null;
db = null;