2013-11-12 10:03:25 +04:00
|
|
|
var middleware = require('../middleware').middleware,
|
2013-11-12 09:27:12 +04:00
|
|
|
api = require('../api');
|
|
|
|
|
|
|
|
module.exports = function (server) {
|
|
|
|
// ### API routes
|
|
|
|
// #### Posts
|
2014-02-14 14:00:11 +04: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 17:00:33 +04:00
|
|
|
server.get('/ghost/api/v0.1/posts/slug/:title', middleware.authAPI, api.requestHandler(api.posts.generateSlug));
|
2013-11-12 09:27:12 +04:00
|
|
|
// #### Settings
|
2014-02-14 14:00:11 +04: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 09:27:12 +04:00
|
|
|
// #### Users
|
2014-02-14 14:00:11 +04: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 09:27:12 +04:00
|
|
|
// #### Tags
|
2014-02-26 21:51:01 +04:00
|
|
|
server.get('/ghost/api/v0.1/tags/', api.requestHandler(api.tags.browse));
|
2014-05-13 18:33:34 +04:00
|
|
|
// #### Themes
|
|
|
|
server.get('/ghost/api/v0.1/themes/', api.requestHandler(api.themes.browse));
|
|
|
|
server.put('/ghost/api/v0.1/themes/:name', api.requestHandler(api.themes.edit));
|
2013-11-12 09:27:12 +04:00
|
|
|
// #### Notifications
|
2014-02-14 14:00:11 +04: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));
|
2014-04-29 00:58:18 +04:00
|
|
|
server.get('/ghost/api/v0.1/notifications/', api.requestHandler(api.notifications.browse));
|
2013-11-12 09:27:12 +04:00
|
|
|
// #### Import/Export
|
2014-02-27 19:48:38 +04:00
|
|
|
server.get('/ghost/api/v0.1/db/', api.requestHandler(api.db.exportContent));
|
2014-02-14 14:00:11 +04: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-04 05:59:09 +04: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 09:27:12 +04:00
|
|
|
};
|