Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Example  





2 Features  





3 References  





4 External links  














Rocket (web framework)







Add links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Rocket
Developer(s)Sergio Benitez[1]
Initial release2016; 8 years ago (2016)
Stable release

0.5.1[2] Edit this on Wikidata / 23 May 2024; 39 days ago (23 May 2024)

Repositorygithub.com/rwf2/Rocket
Written inRust
Operating systemLinux, macOS, Windows, FreeBSD, OpenBSD
TypeWeb framework
LicenseMIT LicenseorApache 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 LicenseorApache 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.

Example[edit]

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[edit]

Rocket implements the following features:

References[edit]

  1. ^ "Sergio Benitez - Who Am I?". sergio.bz. Retrieved 2020-05-30.
  • ^ "Release 0.5.1". 23 May 2024. Retrieved 25 May 2024.
  • ^ Schlothauer, Sarah (December 14, 2018). "Speedy Rust framework for web apps burns through the sky". JAXenter. Retrieved May 29, 2020.
  • ^ Ekwuno, Obinna (October 18, 2019). "The best Rust frameworks to check out in 2019". LogRocket. Retrieved May 29, 2020.
  • ^ "Introduction - Rocket Programming Guide". rocket.rs. Retrieved 2020-05-30.
  • External links[edit]


  • t
  • e

  • Retrieved from "https://en.wikipedia.org/w/index.php?title=Rocket_(web_framework)&oldid=1219130310"

    Categories: 
    Web frameworks
    Free software programmed in Rust
    Software using the Apache license
    Computer library stubs
    Hidden categories: 
    Articles lacking reliable references from December 2023
    All articles lacking reliable references
    All stub articles
     



    This page was last edited on 15 April 2024, at 23:09 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki