Giter VIP home page Giter VIP logo

Comments (3)

kennygrant avatar kennygrant commented on July 21, 2024

Thanks for filing the issue. It should be possible to serve json (I've done it myself), but you'd need a json template and the json header, otherwise it should work, let me know if you have issues doing that specifically what the issues are. You can render content yourself you don't have to use view.Render(), but again happy to adjust view.Render if required to fix any issues.

Re REST I should have said REST-ish if I've used that term anywhere :) It will probably never be fully REST but I'm happy to consider changes to methods etc if they have a practical application. True Rest would have two urls, no update method at all I think, and use http methods to distinguish intent. REST specifies the HTTP method, not the method name in the app, so for example I believe it is supposed to be:

  • Create - POST /resources
  • Update - PUT or PATCH /resources/1
  • Read - GET /resources/1
  • Delete - DELETE /resources/1

Historically browser and server library support for the verbs apart from GET and POST has been patchy, hence we still use POST for delete, not true rest. However, this is complete separate from the action names used to define the actions, which is entirely arbitrary (for example rails uses /edit for update). I haven't looked into browser support recently but would be open to looking at changing the urls for resources if it is fully supported in all possible clients for both html and js. Unfortunately I don't think that's the case. See this stackoverflow question for detail on this:

https://stackoverflow.com/questions/165779/are-the-put-delete-head-etc-methods-available-in-most-web-browsers

As far as I know it is still not part of the html standard for forms, which means we can't use it.

There are other frameworks available if you just want to serve only json in a REST style, so it might also be worth looking at them too, as the focus of fragmenta is more on serving html. I would like it to handle json though so please do file bugs on any specific problems you encounter.

from fragmenta-cms.

SebastianPozoga avatar SebastianPozoga commented on July 21, 2024

as you wrote, it is not rest api. It serve a html webpage. The description is incorrect.

from fragmenta-cms.

kennygrant avatar kennygrant commented on July 21, 2024

REST doesn't care what sort of resources are served, so this is nothing to do with json/html.

I'm closing this now as I don't see any constructive criticism but if you have any specific problems with serving json, do put them here. I'll probably change the comment at some point, it's not a high priority.

from fragmenta-cms.

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.