GithubHelp home page GithubHelp logo

Overhauling Controller about api HOT 7 CLOSED

dingo avatar dingo commented on May 13, 2024
Overhauling Controller

from api.

Comments (7)

terion-name avatar terion-name commented on May 13, 2024

maybe better something like return Response::make($data)->withPaginator()->format('xml')?

from api.

jasonlewis avatar jasonlewis commented on May 13, 2024

I'm trying to keep any sort of formatting related stuff outside of the
controller. The format is set via the Accept header.

On Fri, May 23, 2014 at 9:34 PM, Terion [email protected] wrote:

maybe better something like return
Response::make($data)->withPaginator()->format('xml')?


Reply to this email directly or view it on GitHubhttps://github.com//issues/63#issuecomment-44001189
.

from api.

jasonlewis avatar jasonlewis commented on May 13, 2024

I'm thinking this might also need to belong in Dingo\Api\Http\Response so that if you are using closures for routes you can replace the Response facade and use it much like was shown above.

return Response::withPaginator($paginator);

from api.

philsturgeon avatar philsturgeon commented on May 13, 2024

Sounds good. I only shoved them in the controller because it worked and I didn’t care about closures. Your way sounds better.

from api.

jasonlewis avatar jasonlewis commented on May 13, 2024

So I'm just looking at this now and I'm not too sure what these methods should be doing. I know in your case Phil you'd like to have more control over how Fractal is handled. For others though they might not want that.

My train of thought at the moment is that simply allowing the "magic responses" to be disabled would be the best way forward, for now. That way you can still retain complete control over the responses that are returned.

I may be thinking about this all wrong though. So. Much. Thinking. 😁

from api.

philsturgeon avatar philsturgeon commented on May 13, 2024

Sorry to bump you here mate, I know you've been working hard on Dingo. Where are we at?

from api.

rizqidjamaluddin avatar rizqidjamaluddin commented on May 13, 2024

I know I prefer explicit responses whenever possible. In general I don't like the idea of too many layers doing things between the controller response and the actual response. A config switch, or supporting both, sound reasonable.

from api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.