mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 03:42:27 +03:00
RESTful API
This commit is contained in:
parent
3adbbebc45
commit
0d8866bc8e
8
app.js
8
app.js
@ -63,13 +63,13 @@
|
||||
* @todo auth should be public auth not user auth
|
||||
*/
|
||||
ghost.app().get('/api/v0.1/posts', auth, api.requestHandler(api.posts.browse));
|
||||
ghost.app().post('/api/v0.1/posts', auth, api.requestHandler(api.posts.add));
|
||||
ghost.app().get('/api/v0.1/posts/:id', auth, api.requestHandler(api.posts.read));
|
||||
ghost.app().post('/api/v0.1/posts/create', auth, api.requestHandler(api.posts.add));
|
||||
ghost.app().put('/api/v0.1/posts/edit', auth, api.requestHandler(api.posts.edit));
|
||||
ghost.app()['delete']('/api/v0.1/posts/:id', auth, api.requestHandler(api.posts.destroy));
|
||||
ghost.app().put('/api/v0.1/posts/:id', auth, api.requestHandler(api.posts.edit));
|
||||
ghost.app().del('/api/v0.1/posts/:id', auth, api.requestHandler(api.posts.destroy));
|
||||
ghost.app().get('/api/v0.1/settings', auth, api.requestHandler(api.settings.browse));
|
||||
ghost.app().get('/api/v0.1/settings/:key', auth, api.requestHandler(api.settings.read));
|
||||
ghost.app().put('/api/v0.1/settings/edit', auth, api.requestHandler(api.settings.edit));
|
||||
ghost.app().put('/api/v0.1/settings', auth, api.requestHandler(api.settings.edit));
|
||||
|
||||
/**
|
||||
* Admin routes..
|
||||
|
@ -61,9 +61,9 @@
|
||||
urlSegments = window.location.pathname.split('/');
|
||||
|
||||
if (urlSegments[2] === 'editor' && urlSegments[3] && /^[a-zA-Z0-9]+$/.test(urlSegments[2])) {
|
||||
entry.id = urlSegments[3];
|
||||
var id = urlSegments[3];
|
||||
$.ajax({
|
||||
url: '/api/v0.1/posts/edit',
|
||||
url: '/api/v0.1/posts/' + id,
|
||||
method: 'PUT',
|
||||
data: entry,
|
||||
success: function (data) {
|
||||
@ -75,7 +75,7 @@
|
||||
});
|
||||
} else {
|
||||
$.ajax({
|
||||
url: '/api/v0.1/posts/create',
|
||||
url: '/api/v0.1/posts',
|
||||
method: 'POST',
|
||||
data: entry,
|
||||
success: function (data) {
|
||||
|
@ -48,7 +48,7 @@
|
||||
var data = getSettings();
|
||||
$.ajax({
|
||||
method: 'PUT',
|
||||
url: '/api/v0.1/settings/edit',
|
||||
url: '/api/v0.1/settings',
|
||||
data: data,
|
||||
success: function (res, xhr, c) {
|
||||
console.log(xhr, c);
|
||||
|
Loading…
Reference in New Issue
Block a user