

Floor – Web development with Rust - cburgdorf
http://cburgdorf.github.io/Floor/doc/floor/index.html

======
daviskim
It's still in development, but this may turn out better:
[https://github.com/iron/iron](https://github.com/iron/iron)

~~~
kenko
Maybe so, but jesus christ, is it some kind of rule that every framework needs
to invent its own cutesy-poo vocabulary loosely related to its name? If
"ingots" are just middleware, just say middleware. And WTF is a Furnace? I see
there's also "Alloy".

~~~
bshimmin
And also:

    
    
        server.smelt(JSON::new());
    

At least they're consistently hip!

------
bshimmin
This

    
    
        request.params.get(&"userid".to_string()).as_slice()
    

is rather ugly in comparison with Express's `req.params.userid` (or Sinatra's
`params[:userid]`). Can something nicer be done here?

~~~
kibwen
At any given moment, there will exist at least one feature of Rust that is
suffering temporary workarounds as a result of flux in the implementation.
Strings are such a feature at the moment, and ugly code like the above is the
interim solution. It will look nicer for 1.0. :)

~~~
bshimmin
Great: I wasn't sure if it was a feature of the framework or the language!
Like many others here, I'm looking forward to playing with Rust in earnest
once it's a little more mature.

------
leorocky
Cool. Question though, can Floor serve HTTPS requests? Can it make requests to
SSL protected API resources or make a TCP connection with SSL? Is that part of
the API or easy to do? If so I'll give this a try. Thanks for making this.

Edit:

I don't think it does let you serve HTTPS requests:

[https://github.com/cburgdorf/Floor/blob/548916fe7e4cbdc67eed...](https://github.com/cburgdorf/Floor/blob/548916fe7e4cbdc67eed22095a49e5a6d32727ff/src/request.rs)

One could SSL terminate with nginx though, but the problem of easy SSL in Rust
persists.

~~~
cburgdorf
Floors author here. I'm glad Chris Morgan answered already because there isn't
much I could have told you about that. I'm relying on all the great groundwork
Chris already put into rust-http. Keep an eye on
[http://teepee.rs/](http://teepee.rs/). It will soon become the more advanced
replacement of rust-http.

~~~
leorocky
teepee looks awesome! Thanks.

------
mercurial
It's nice to see so much activity around Rust. On the other hand, the
frameworks I've seen seem to all suffer from the same issue: they seem to be
intended for very simple use cases. How do you plugin an authentication
middleware? How do you do resource traversal?

~~~
cburgdorf
Floors author here. It's great to have people like you commenting on such
things so that other people like me get ideas for things to hack on :)

That said, I'm still learning the basics of Rust and therefore try to narrow
the scope. Floor strives for simplicity rather than being feature rich. When I
turned to Rust I was disappointed to see what the state of web development
was. It seemed to be extremely complicated to even write a very simple web
server. Especially compared to how easy such things are with something like
express.js.

Rust is still under heavy development but I think we will see a lot of those
missing bits popping out here and there in the coming months.

------
itsadok
Can somebody shed a light on what the ''a means in the Request type?

    
    
      pub struct Request<''a> {
          pub origin: &''a Request,
          pub params: HashMap<String, String>, 
      }

~~~
dbaupp
The doubled ' is just a bug in the documentation generator (fixed by
[https://github.com/mozilla/rust/pull/14900](https://github.com/mozilla/rust/pull/14900),
which is unfortunately (and strangely) failing tests at the moment).

Its true form is

    
    
       pub struct Request<'a> {
           pub origin: &'a Request,
           pub params: HashMap<String, String>
       }
    

where the 'a is representing the lifetime of the origin reference (that is, it
is asserting that a Request struct is only usable for as long as the reference
in the `origin` field is valid). Lifetimes/references are one of the core
features of Rust guaranteeing both memory safety and performance.

See also: [http://doc.rust-lang.org/master/guide-
lifetimes.html](http://doc.rust-lang.org/master/guide-lifetimes.html)

~~~
dbaupp
(Sorry, I misspoke, #14900 is fixing a different rustdoc issue: the fix for ''
is
[https://github.com/mozilla/rust/pull/14906](https://github.com/mozilla/rust/pull/14906)
.)

------
mosselman
[http://i.imgur.com/B4Tzj7w.gif](http://i.imgur.com/B4Tzj7w.gif)

