TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
47.68k stars 10.41k forks source link

Using Ghost as backend to an Ember app #4874

Closed taras closed 9 years ago

taras commented 9 years ago

I'm in the process of setting up EmberSherpa blog and I would like to use Ember on the frontend and Ghost backend. I'm going to modify the Ghost theme and build the blog frontend app in Ember. It will use the Ghost API to pull posts and author information.

With this PR to EmberCLI, I'm able to boot Ghost as a middleware on EmberCLI's Express server. At first, I was mounting the app on /blog subdirectory, but now I'm realizing that this displays the blog on the frontend.

Ideally, I would be able to disable the frontend and use Ghost as an Admin interface and an API provider.

What would it take to make this possible?

/cc @ErisDS @hswolff

jaswilli commented 9 years ago

I don't think there's an easy way to disable the frontend. An option would be to only proxy /ghost so that the admin app and API would be available. The frontend/blog would still be running of course but at least it wouldn't be publicly accessible.

taras commented 9 years ago

@jaswilli what about a difficult way of doing it? I'm willing to do the work to get it work

jaswilli commented 9 years ago

Absent someone recognizing a way really clever way to disable it, the frontend (blogApp) would have to be refactored to be isolated from the everything related to the admin and API. I think currently some API-related routes and middleware get applied to the blogApp, which is problematic for the use case you're after.

I'll link to a couple relevant areas if you want to take a look:

Here's where the express app instances come into existence: https://github.com/TryGhost/Ghost/blob/master/core/server/index.js#L133

And this is where the middleware and routes get applied: https://github.com/TryGhost/Ghost/blob/master/core/server/middleware/index.js#L241

taras commented 9 years ago

@jaswilli thank you. I'm looking there now. I'll keep you posted

jaswilli commented 9 years ago

No problem. Feel free to hit me up on irc (jtw).

taras commented 9 years ago

This turned out to be a bad idea. I'm now exploring how to properly run Ghost behind a proxy.