Low-level web programming in Racket and a wiki in 500 lines
21–29 of 29 posts
Re: Low-level web programming in Racket and a wiki in 500 lines
#22Very nice proof of concept. Just a word of warning: In practice you want to sanitize your input. The code in "Serving static files" allows to break out of document-root with "..".
; extract the URI from the request:
(define uri (request-uri req))
; extract the resource from the URI:
(define resource
(map path/param-path (url-path uri)))
; find the file location:
(define file (string-append
document-root
"/"
(string-join resource "/")))Re: Low-level web programming in Racket and a wiki in 500 lines
#23I'm glad to see someone talking about using the lower-level web libraries in Racket. The high-level continuation-based ones are ridiculously unsuitable for actual web programming (they store full state on the server at all times, and the URL gives you full access to the session, among other issues), but the lower-level ones actually look pretty clean and modern. And yet all the documentation keeps talking about the c…
The documentation discusses the features of the Web framework, many of which have to do with its unique aspects. As you can see in this post, all normal Web programming is possible and easy, but there's very little special to say about it, because it's just a normal program.
Re: Low-level web programming in Racket and a wiki in 500 lines
#24Earlier quoted context omitted.
How exactly are you hung up with form data? Its low level, so you certainly can't get validation out of box, but otherwise in my experience getting form data out is fairly straight forward. I recently wrote my first Racket web app. Its not pretty or following best practices but you can take a look. https://github.com/vishesh/whalebin
Thank you! Your project was helpful to skim through. Do you have any additions to the web-project-bootstrap.rkt project? BTW, this is what I mean by form bindings being confusing: according to the docs, request-bindings is dangerous and shouldn't be used http://docs.racket-lang.org/web-server/http.html#%28mod-path... . That's kind of confusing, because request-bindings is used in the tutorial docs: http://docs.racket…
Re: Low-level web programming in Racket and a wiki in 500 lines
#25Hijacking: Can anyone tell me how to make a Scribble website have CSS like in HTDP?
http://docs.racket-lang.org/scribble/config-style.html?q=css
Re: Low-level web programming in Racket and a wiki in 500 lines
#26Earlier quoted context omitted.
How exactly are you hung up with form data? Its low level, so you certainly can't get validation out of box, but otherwise in my experience getting form data out is fairly straight forward. I recently wrote my first Racket web app. Its not pretty or following best practices but you can take a look. https://github.com/vishesh/whalebin
Thank you! Your project was helpful to skim through. Do you have any additions to the web-project-bootstrap.rkt project? BTW, this is what I mean by form bindings being confusing: according to the docs, request-bindings is dangerous and shouldn't be used http://docs.racket-lang.org/web-server/http.html#%28mod-path... . That's kind of confusing, because request-bindings is used in the tutorial docs: http://docs.racket…
http://docs.racket-lang.org/web-server/http.html?q=request#%...
Re: Low-level web programming in Racket and a wiki in 500 lines
#27Isn't your `any?` function actually `ormap`[0]? You should be able to do the same thing with: (ormap password-matches? line) 0 - http://docs.racket-lang.org/reference/pairs.html?q=ormap#%28...
Re: Low-level web programming in Racket and a wiki in 500 lines
#28I'm glad to see someone talking about using the lower-level web libraries in Racket. The high-level continuation-based ones are ridiculously unsuitable for actual web programming (they store full state on the server at all times, and the URL gives you full access to the session, among other issues), but the lower-level ones actually look pretty clean and modern. And yet all the documentation keeps talking about the c…
The continuation-based libraries are the simplest, easiest, quickest way to get a program off the ground. They make interactive Web programming just as easy as writing “scanf” or its equivalent, _and_ are safe in the face of various browser interactions. Therefore, they're a good default for prototyping. However, I agree that they also have issues, and the documentation should not over-emphasize them, but rather indi…
Re: Low-level web programming in Racket and a wiki in 500 lines
#29I'm glad to see someone talking about using the lower-level web libraries in Racket. The high-level continuation-based ones are ridiculously unsuitable for actual web programming (they store full state on the server at all times, and the URL gives you full access to the session, among other issues), but the lower-level ones actually look pretty clean and modern. And yet all the documentation keeps talking about the c…
The issues you mention are all alleviated by the stateless continuations which do not store state on the server and allow various ways of closing off the session from simply having the URL. The documentation discusses the features of the Web framework, many of which have to do with its unique aspects. As you can see in this post, all normal Web programming is possible and easy, but there's very little special to say…