Rocket (web framework)

RocketDeveloper(s)| Sergio Benitez[1]

|

Initial release| 2016; 10 years ago (2016)
Repository| github.com/SergioBenitez/Rocket
Written in| Rust
Operating system| Linux, macOS, Windows, FreeBSD, OpenBSD
Type| Web framework
License| MIT License or Apache License
Website| rocket.rs

Rocket is a web framework written in Rust.[2][3] It supports HTTP Requests, Web Sockets JSON, Templating and more. Its design was inspired by Rails, Flask, Bottle, and Yesod.[4] 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.

## Contents

* 1 Example
* 2 Features
* 3 References
* 4 External links

## 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, John year old named 20!`.

## 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 `/hello`route 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?". https://sergio.bz/.
2. ↑ Schlothauer, Sarah (December 14, 2018). "Speedy Rust framework for web apps burns through the sky". https://jaxenter.com/rust-framework-rocket-153179.html.
3. ↑ Ekwuno, Obinna (October 18, 2019). "The best Rust frameworks to check out in 2019". https://blog.logrocket.com/the-best-rust-frameworks-to-check-out-in-2019/.
4. ↑ "Introduction - Rocket Programming Guide". https://rocket.rs/v0.4/guide/introduction/.

## External links

* Github Code Repository

* v
* t
* e

Web frameworks

* Comparison

C++|

* CppCMS
* Wt

CLI|

* ASP.NET
* Core
* AJAX
* Dynamic Data
* MVC
* Razor
* Web Forms
* DNN
* BFC
* MonoRail
* OpenRasta
* Umbraco
* WebSharper

ColdFusion|

* CFWheels
* ColdBox Platform
* ColdSpring
* Fusebox
* Model-Glue

Common Lisp|

* Caveman2
* CL-HTTP
* Weblocks

Haskell|

* Yesod
* Snap

Java|

* AppFuse
* Flexive
* Grails
* GWT
* ICEfaces
* ItsNat
* JavaServer Faces
* JHipster
* Jspx
* JWt
* OpenXava
* Play
* Remote Application Platform
* RIFE
* Seam
* Sling
* Spring
* Stripes
* Struts
* Tapestry
* Vaadin
* Vert.x
* WebWork
* Wicket
* WaveMaker
* ZK

JavaScript|

* Angular/AngularJS
* Backbone.js
* Chaplin.js
* Closure
* Dojo Toolkit
* Ember.js
* Express.js
* Ext JS
* jQuery
* Knockout.js
* Meteor
* MooTools
* Node.js
* OpenUI5
* Prototype
* React
* Rico
* script.aculo.us
* Sencha Touch
* SproutCore
* Svelte
* Vue.js
* Wakanda

Perl|

* Catalyst
* Dancer
* Mason
* Maypole
* Mojolicious
* WebGUI

PHP|

* CakePHP
* CodeIgniter
* Drupal
* Fat-Free
* FuelPHP
* Flow
* Grav
* Gyroscope
* Horde
* Joomla
* Kohana
* Laravel
* Lithium
* Midgard
* MODX
* Nette
* Phalcon
* PHP-Fusion
* Pop PHP
* PRADO
* ProcessWire
* Qcodo
* Silex
* SilverStripe
* Symfony
* TYPO3
* WordPress
* XOOPS
* Yii
* Zend Framework

Python|

* BlueBream
* CherryPy
* Django
* Flask
* Grok
* Nevow
* Pyjs
* Pylons
* Pyramid
* Quixote
* TACTIC
* Tornado
* TurboGears
* web2py
* Webware
* Zope 2
* more...

Ruby|

* Camping
* Merb
* Padrino
* Ruby on Rails
* Sinatra

Scala|

* Lift
* Play
* Scalatra

Smalltalk|

* AIDA/Web
* Seaside

Other languages|

* Vibe.d (D)
* Application Express (PL/SQL)
* Grails (Groovy)
* Kepler (Lua)
* OpenACS (Tcl)
* Phoenix (Elixir)
* SproutCore (JavaScript-Ruby)
* Yaws (Erlang)

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Rocket (web framework). Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:Rocket_(web_framework)&oldid=679379"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template