Comments (6)
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.
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.
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.
Yeah. I will create a branch with some modifications to Jester. Let's see how that works out!
from jester.
Awesome :)
from jester.
Any news on this?
from jester.
Related Issues (20)
- static files respond to non-GET http methods HOT 1
- No way to get raw query parameters
- Relative staticDir behavior changed
- Double log output on http requests HOT 1
- Jester crashes when async sleeping HOT 5
- development on windows (httpbeast) HOT 1
- finally block getting called twice? HOT 3
- Support binding on IPv6 address
- `std/cgi` will be moved to nimble packages
- Runtime SIGBUS: HOT 1
- how to use the setCookie fuction? HOT 1
- Docs: adding sections
- formData identical keys
- Bump tag to give new version through nimble HOT 2
- Revert PR #171 which auto decodes URL parameters HOT 6
- The jester.nimble file needs to be updated for v0.6.0 HOT 2
- Cannot serve dynamic web pages HOT 1
- Jester is not working with nim version 2.0.0 HOT 4
- static folder not working HOT 3
- Fix for SIGSEGV: Illegal storage access from lib/system/orc.nim nimIncRefCyclic HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jester.