/rocket_simple_app

Rocket simple application

Primary LanguageRust

Rocket simple application

Build Status Crates.io GitHub repo size Crates.io Crates.io

Rocket is a web framework for Rust (nightly) with a focus on ease-of-use, expressibility, and speed. Here's an example of user register and authorization.

Getting Started

#1 We need to install a safe, extensible ORM and Query Builder for Rust "https://diesel.rs/guides/getting-started."

cargo install diesel_cli

#2 Build our application.

cargo build

#3 Database connection .env.

DATABASE_URL=mysql://username:password@hostname/dbname

#4 Run migration

giorgi@giorgi:~/rocket_simple_app$ diesel migration run
Running migration 2019-11-16-000655_create_users_sessions
Running migration 2019-11-19-080726_create_users

#5 Runing our application.

giorgi@giorgi:~/rocket_simple_app$ cargo run
   Compiling rocket_simple_app v0.1.0 (/home/giorgi/rocket_simple_app)
    Finished dev [unoptimized + debuginfo] target(s) in 3.55s
     Running `target/debug/rocket_simple_app`
🔧 Configured for development.
    => address: localhost
    => port: 8000
    => log: normal
    => workers: 8
    => secret key: generated
    => limits: forms = 32KiB
    => keep-alive: 5s
    => tls: disabled
🛰  Mounting /:
    => GET / (index)
    => GET /login (login)
    => POST /login (authorization)
    => GET /register (register)
    => POST /register (registration)
📡 Fairings:
    => 1 request: Templates
🚀 Rocket has launched from http://localhost:8000

Visiting http://localhost:8000/.