Giter VIP home page Giter VIP logo

Comments (6)

dom96 avatar dom96 commented on July 26, 2024

My main targets would be extending the current code in a way that headers are not something which is handled "just in the end" of handling a request.

I'm not sure what you mean by this. How are headers only handled at the end of the request? You can set them at any time in your route.

I also believe that "status code" has not really a lot to do with the content you send. Many "error code" responses could have a nice HTML page or for example json content.

Are you referring to the resp templates? Again, you can set the status code outside of that via https://github.com/dom96/jester/blob/master/jester.nim#L353.

As another example: There are a lot of different and meaningful ways of redirection besides 303 so this needs to be a parameter (with a sensible default).

Agree on this point.

If those changes are in the scope for Jester I can try to improve the headers and some other stuff. I am not sure how much time I can invest because I can't move our projects to Jester and Nim.

Caching certainly is in Jester's scope.

from jester.

oderwat avatar oderwat commented on July 26, 2024

Well I have no experience with Jester and just glanced over the code.

I found "sendStaticIfExists()" (the reason why I looked in the first place) which (seems to) ignore all headers. I saw something like that for the redirect and the server error page. And there are four "sendHeaders()" procs but only one is actually taking headers as parameter. I know see that they are probably meant for sending raw content "myself". Still they could handle stuff like etags or ifmodified "before" I send my data. But this maybe just gave me a wrong impression.

Besides that: I am sure I could do anything with current jester if I handle everything myself. Thats why I asked about how much the framework should prepare. I scrolled through the "sinatra" code and I think I saw there what I kinda miss here. Which would make sense considering that Jester is not done yet!

In general I don't talk about individual headers a user would set for his "special stuff" but about the headers the framework would handle automatically. Think of the cookies.

I actually mean that the respective headers should be auto generated (as late as possible) based on features which are activated earlier in the process.

Lets say I want to enable compression for "every content" or I want to use "if-modified-since" and as such would always generate "last-modified" headers.

These should be handled inside or "near" to statusContent(). My framework has some step which generates the needed headers just before calling something similar.

statusContent() itself could then handle the transparent compression (if enabled or 'still' enabled), which would create new headers.

There could also be a "checkETags" feature which in (or near) to statusContent() checks if a resending of the resource is desired .. or just says: not modified.

Or let me set "expire" for a group of files / (static) route and I would say "expire this in 10 minutes". And the framework will generate the headers I need for that. Similar to an Apache config, where you say: expire this like that...

Same with "I want to check for if-modified" and the framework would parse the header and short circuits the serving of a static resource.

About the Status code... I think that was a wrong impression I saw the "halt" and 303 and static 404 without sending content. I would not send "404" without a content in most of my sites. Not sure how that all plays out in the end.

I may not understand some concepts followed yet and I will try some Jester / Forum myself and come back for discussion before I mess anything up!

from jester.

dom96 avatar dom96 commented on July 26, 2024

I may not understand some concepts followed yet and I will try some Jester / Forum myself and come back for discussion before I mess anything up!

Yes, please try it out first. What you talk about should be possible. Would be awesome if you showed me some example code and told me what you expect it to do.

from jester.

oderwat avatar oderwat commented on July 26, 2024

Yeah. I will create a branch with some modifications to Jester. Let's see how that works out!

from jester.

dom96 avatar dom96 commented on July 26, 2024

Awesome :)

from jester.

dom96 avatar dom96 commented on July 26, 2024

Any news on this?

from jester.

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.