2013-11-12 01:03:25 -05:00
|
|
|
var middleware = require('../middleware').middleware,
|
2013-11-12 00:27:12 -05:00
|
|
|
api = require('../api');
|
|
|
|
|
|
|
|
module.exports = function (server) {
|
|
|
|
// ### API routes
|
|
|
|
// #### Posts
|
2014-02-14 05:00:11 -05:00
|
|
|
server.get('/ghost/api/v0.1/posts', api.requestHandler(api.posts.browse));
|
|
|
|
server.post('/ghost/api/v0.1/posts', api.requestHandler(api.posts.add));
|
|
|
|
server.get('/ghost/api/v0.1/posts/:id', api.requestHandler(api.posts.read));
|
|
|
|
server.put('/ghost/api/v0.1/posts/:id', api.requestHandler(api.posts.edit));
|
|
|
|
server.del('/ghost/api/v0.1/posts/:id', api.requestHandler(api.posts.destroy));
|
2014-03-18 08:00:33 -05:00
|
|
|
server.get('/ghost/api/v0.1/posts/slug/:title', middleware.authAPI, api.requestHandler(api.posts.generateSlug));
|
2013-11-12 00:27:12 -05:00
|
|
|
// #### Settings
|
2014-02-14 05:00:11 -05:00
|
|
|
server.get('/ghost/api/v0.1/settings/', api.requestHandler(api.settings.browse));
|
|
|
|
server.get('/ghost/api/v0.1/settings/:key/', api.requestHandler(api.settings.read));
|
|
|
|
server.put('/ghost/api/v0.1/settings/', api.requestHandler(api.settings.edit));
|
2013-11-12 00:27:12 -05:00
|
|
|
// #### Users
|
2014-02-14 05:00:11 -05:00
|
|
|
server.get('/ghost/api/v0.1/users/', api.requestHandler(api.users.browse));
|
|
|
|
server.get('/ghost/api/v0.1/users/:id/', api.requestHandler(api.users.read));
|
|
|
|
server.put('/ghost/api/v0.1/users/:id/', api.requestHandler(api.users.edit));
|
2013-11-12 00:27:12 -05:00
|
|
|
// #### Tags
|
2014-02-26 12:51:01 -05:00
|
|
|
server.get('/ghost/api/v0.1/tags/', api.requestHandler(api.tags.browse));
|
2013-11-12 00:27:12 -05:00
|
|
|
// #### Notifications
|
2014-02-14 05:00:11 -05:00
|
|
|
server.del('/ghost/api/v0.1/notifications/:id', api.requestHandler(api.notifications.destroy));
|
|
|
|
server.post('/ghost/api/v0.1/notifications/', api.requestHandler(api.notifications.add));
|
2013-11-12 00:27:12 -05:00
|
|
|
// #### Import/Export
|
2014-02-27 10:48:38 -05:00
|
|
|
server.get('/ghost/api/v0.1/db/', api.requestHandler(api.db.exportContent));
|
2014-02-14 05:00:11 -05:00
|
|
|
server.post('/ghost/api/v0.1/db/', middleware.busboy, api.requestHandler(api.db.importContent));
|
|
|
|
server.del('/ghost/api/v0.1/db/', api.requestHandler(api.db.deleteAllContent));
|
2014-04-03 20:59:09 -05:00
|
|
|
// #### Mail
|
|
|
|
server.post('/ghost/api/v0.1/mail', api.requestHandler(api.mail.send));
|
|
|
|
server.post('/ghost/api/v0.1/mail/test', api.requestHandler(api.mail.sendTest));
|
2013-11-12 00:27:12 -05:00
|
|
|
};
|