To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Rocket (web framework)

From Wikipedia, the free encyclopedia

Rocket
Developer(s)Sergio Benitez[1]
Initial release2016; 8 years ago (2016)
Stable release
0.5.0[2] Edit this on Wikidata / 17 November 2023; 4 months ago (17 November 2023)
Repositorygithub.com/rwf2/Rocket
Written inRust
Operating systemLinux, macOS, Windows, FreeBSD, OpenBSD
TypeWeb framework
LicenseMIT License or Apache License
Websiterocket.rs

Rocket is a web framework written in Rust.[3][4] It supports HTTP requests, Web Sockets JSON, templating and more. Its design was inspired by Rails, Flask, Bottle, and Yesod.[5] It licensed under MIT License or Apache License.

To create a web server with Rocket, the user will define an application, then use the "mount" function to attach "routes" to it. Each "route" is a rust function with a macro attched to it. The function will define code that should response to an HTTP request. The macro that is written as part of the function decleration will define which HTTP Method (such as GET, POST, PUT, etc.) it should be handle, as well as a pattern describing the URL it should be relevant to.

YouTube Encyclopedic

  • 1/3
    Views:
    3 510
    2 477
    25 723
  • Actix vs Rocket. Rust Lang Web Framework perf off. Is Actix Web that fast? Is Rocket fast enough?
  • Rocket web framework for Rust - first experience (live coding)
  • Rust Web development | Boilerplate free with Rocket [2020]

Transcription

Example

This is an example of a working rocket application:

#[macro_use] extern crate rocket;

#[get("/hello/<name>/<age>")]
fn hello(name: &str, age: u8) -> String {
    format!("Hello, {} year old named {}!", age, name)
}

#[launch]
fn rocket() -> _ {
    rocket::build().mount("/", routes![hello])
}

Sending an HTTP GET request to /hello/John/20 would return the following response:

Hello, 20 year old named John!.

Features

Rocket implements the following features:

  • Routing - Rocket allows the user to define the structure of routes that the application should consider, as well as the code that should run in different routing combination. For example, the following code will make the rocket application to respond to the /helloroute with "Hello World":
    #[get("/")]
    fn index() -> &'static str {
        "Hello, world!"
    }
    
  • Form Data - Rocket allows the user to define a Serde model, and use it to parse the Form Data, and pass it as native rust object to the route handler.
  • Request Guards - the route handlers can contain a special kind of parameters named "Request Guard"s that are meant to prevent the code inside the handler to be called in case a certain condition is not met. This feature can be used for example, to prevent requests that do not contain a API Key. By using the Request Guard feature, the user can define the condition in one place, and apply it to prevent access to multiple routes by adding the guard to their list of parameters.

References

  1. ^ "Sergio Benitez - Who Am I?". sergio.bz. Retrieved 2020-05-30.
  2. ^ "Rocket v0.5: Stable, Async, Sentinels, Streams, SSE, Forms, WebSockets, & So Much More".
  3. ^ Schlothauer, Sarah (December 14, 2018). "Speedy Rust framework for web apps burns through the sky". JAXenter. Retrieved May 29, 2020.
  4. ^ Ekwuno, Obinna (October 18, 2019). "The best Rust frameworks to check out in 2019". LogRocket. Retrieved May 29, 2020.
  5. ^ "Introduction - Rocket Programming Guide". rocket.rs. Retrieved 2020-05-30.

External links


This page was last edited on 12 April 2024, at 07:27
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.