Building Web Applications with Rocket

2019-04-25

About Rust Basel

  • Founded today
  • Just me (and anyone in the meetup group who wants to participate)

Inspired by

  • Rust ZH
  • Other meetups in Basel
  • Rust the language
    • don't worry about 'small', it will pay off 

For and by enthusiasts

  • Rust is a systems language and allows you to go "down to the metal"
  • Therefore it is a language for enthusiasts
  • Speed and efficiency enthusiasm should be at the center of this group

About me and Rust

  • Basically this is about Scala

Beginners welcome

  • I am a beginner
  • Rust beginners =/= overall beginners
    • Rust is probably not the best 'first language'
  • If you're already a pro, please have the next talk

Purpose

  • promote
  • discover together

Help wanted

  • talks
  • sponsors
  • hosts
  • ideas
  • spread the word
  • ...

Rocket

Rocket is a web framework for Rust that makes it simple to write fast, secure web applications without sacrificing flexibility, usability, or type safety.

WASM?

  • So Rust is for WebAssembly, right?
  • The new Javascript?
  • Sorry, not tonight...
  • We'll look at 2000's architecture:
    • Server-side
    • no (or little) ajax
    • Like PHP Frameworks, Ruby on Rails

Conservative system design

  • classical backend framework with
    • routing
    • templating
    • form validation
    • cookies
    • (relational) database support

Feels familiar

  • Rails
  • Symfony
  • Express

Feels complete

Framework

  • Agent based testing
  • Included templating language
  • Multi-env config
  • Middleware (fairings)
  • Live Reload

Rust

  • Cargo, Rustdocs, Doctests
  • Type System
  • Diesel ORM

Leverages Rust

  • Uses nightly features (procedural macros, declarative macros 2.0)
    • as a route DSL:

Actix vs Rocket

  • looked at Actix & Rocket.
  • Actix is more modular, less "packaged"
  • Went for rocket bc of docs, examples, speed
  • while taking into account current disadvantage (dependent on nightly)
  • for prod, I might suggest Actix today

Example

https://github.com/SergioBenitez/Rocket/tree/master/examples

  • walk through code
  • run it and have a look at load

IDE & Build tools

  • Plugins for all major IDEs
    • IntelliJ
    • VS Code
    • Vim
    • Atom
  • Debugging integration via GDB into CLion

Repositories, Documentation

 

  • Cargo
  • crates.io
  • Rustdocs

 

= Community tooling

This is where Rust really shines!

Resources

  • Rocket online documentation
  • Exemples
    • including tests
  • Rust built-in books
    • rustup doc
  • Book to the right (highly recommended)

Questions?

Thanks!

  • for coming
  • for your future involvement with this meetup
  • to my employer greenmatch for providing the room
    • we are hiring full stack developers

Feedback, Outlook

  • Cards
  • Comments at meetup.com
  • Discussion (now)

Building Web Applications with Rocket

By Roland Brand

Building Web Applications with Rocket

  • 76