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));
|
2013-12-20 17:36:00 +04:00
|
|
|
server.get('/ghost/api/v0.1/posts/getSlug/:title', middleware.authAPI, api.requestHandler(api.posts.getSlug));
|
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));
|
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));
|
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));
|
2013-11-12 09:27:12 +04:00
|
|
|
};
|