Skip to content

Instantly share code, notes, and snippets.

@yssk22
Created December 8, 2010 15:32
Show Gist options
  • Save yssk22/733415 to your computer and use it in GitHub Desktop.
Save yssk22/733415 to your computer and use it in GitHub Desktop.
what I want.
exports.application = function(server){
server.get('/',
newsFeeds,
misc.title('Home'), misc.renderWithBindings('index.ejs'));
server.get('/login', authorized, misc.redirect('/'));
server.get('/logout', oauth.logout, misc.redirect('/'));
server.get('/profiles/', authorized, misc.renderWithBindings('profiles/index.ejs'));
server.get('/archives/', authorized, misc.renderWithBindings('archives/index.ejs'));
server.get('/schedules/list',
google.calendar(GCAL_URL),
misc.renderWithBindings('schedules/list.ejs', {layout: false}));
server.get('/posts/',
couchdb.proxiedTo("/_design/posts/_view/recent", {
limit: 10,
descending: true,
as: 'posts'
}),
misc.renderWithBindings('posts/index.ejs')
);
server.get('/posts/new',
function(req, res, next){
res.bindings['post'] = {
title: "",
content: ""
};
next();
},
postEditor);
server.post('/posts/',
function(req, res, next){
req.body.type = 'post';
req.body.created_at = new Date();
req.body.updated_at = new Date();
req.body.created_by = 'yssk22';
req.body.updated_by = 'yssk22';
next();
},
couchdb.proxiedTo('/', {
as: 'post',
success: redirect('/'),
failure: postEditor
}));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment