-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restful API? #664
Comments
For about a year now I've thought that Forem would be much better if it was just a JSON API without a frontend at all. A lot of people just customise the frontend or ditch it entirely. Most people don't use what we supply. I had a similar set of thoughts when I worked at Spree too. I haven't had the time to invest in doing the work because I've been too busy with my full-time job and writing books. I think it sounds like a step in the right direction. We should not use Rabl for this as I've had issues with it ; in my experience with building a Rabl-backed API for Spree. Grape is not that great either. I'm fine with it being straight jbuilder views in Rails. I think it should comply with the JSON API specification. It should be versioned and access should be granted with user-based API keys (i.e. each user can have an API key generated to access Forem). Please do it :) |
What are your thoughts on view counts? In an API-based app, there isn't necessarily a one-to-one correspondence between a browser requesting data for a topic and a user viewing that topic. Should we bother having an explicit "views" API where a client can let the server know what the user's been looking at? |
I think if a topic has been retrieved directly (i.e a request like /forums/blah/topics/foo) then that should count as a view. Having a separate endpoint for this doesn't make much sense imo. What's you're reasoning for having a separate endpoint? |
I forget. I mean, I can imagine building an app in various ways that request a forum endpoint with included topic data, or that request topics and don't necessarily render them. But I'm not currently doing that, so maybe I was just overthinking it. |
Could it be an optional url parameter for such cases when you want to preload some forums/topics? |
I need to add a forum to an existing Rails app with an Angular front end. An option I'm considering is adopting Forem (which I've used before), taking advantage of its data model and possibly URL structure, and adding a JSON API. Does this sound like a good or bad idea to anyone?
And have you given any thought to an approach? It looks like the best options are either to integrate with the existing routes/controllers and add JSON views (maybe using RABL) or to build out a separate HTTP/URL structure (using something like Grape). I'm inclined to use RABL because that's what we're doing in the main engine of my application, but if there's a strong preference from the team, I'd rather do something that's likely to get integrated into Forem.
The text was updated successfully, but these errors were encountered: