### Setup and Run Diesel Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/diesel/README.md Commands to set up the database using Diesel CLI and run the Gotham application. Requires `diesel_cli` to be installed. ```bash DATABASE_URL=products.db diesel database setup Creating database: products.db Running migration 2019-04-09-111334_create_products cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.61 secs Running `../gotham_diesel_example` Listening for requests at http://127.0.0.1:7878 ``` -------------------------------- ### Run the example application Source: https://github.com/gotham-rs/gotham/blob/main/examples/middleware/multiple_pipelines/README.md Starts the Gotham example application from the project directory. ```bash $ cargo run Compiling gotham_examples_middleware_multiple_pipelines v0.0.0 (file:///home/colin/code/gotham/gotham/examples/middleware/multiple_pipelines) Finished dev [unoptimized + debuginfo] target(s) in 12.67s Running `/home/colin/code/gotham/gotham/target/debug/gotham_examples_middleware_multiple_pipelines` Listening for requests at http://127.0.0.1:7878 ``` -------------------------------- ### Running the Introductory Router Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/routing/introduction/README.md This example shows how to compile and run the introductory router example. It also demonstrates how to send a request using curl and the expected output. ```bash Terminal 1: $ cargo run Compiling gotham_examples_routing_introduction v0.0.0 (file://.../examples/routing/introduction) Finished dev [unoptimized + debuginfo] target(s) in 2.42 secs Running `.../target/debug/gotham_examples_routing_introduction` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 13 < Content-Type: text/plain < X-Request-ID: e4c3fb68-9f70-43ee-9fd2-1bb0ec7a7548 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 123 < Date: Sun, 11 Feb 2018 22:55:26 GMT < * Connection #0 to host 127.0.0.1 left intact Hello Router!% ``` -------------------------------- ### Run and Test Form Handler Source: https://github.com/gotham-rs/gotham/blob/main/examples/handlers/form_urlencoded/README.md Instructions for starting the example server and sending a test request using curl. ```bash Terminal 1: $ cargo run Compiling handlers/form_urlencoded (file:///.../examples/handlers/form_urlencoded) Finished dev [unoptimized + debuginfo] target(s) in 4.26 secs Running `../handlers/form_urlencoded` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -d name=Bob -d address="123 Jersey Ave." -d message="Hello world!" http://127.0.0.1:7878/ name: Bob address: 123 Jersey Ave. message: Hello world! ``` -------------------------------- ### Run Gotham Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/routing/associations/README.md Execute the Gotham routing associations example from the command line. This shows the compilation and runtime output when the server starts. ```bash Terminal 1: $ cargo run Compiling gotham_examples_routing_associations v0.0.0 (file://.../gotham/examples/routing/associations) Finished dev [unoptimized + debuginfo] target(s) in 2.48 secs Running `.../gotham/target/debug/gotham_examples_routing_associations` Listening for requests at http://127.0.0.1:7878 ``` ```bash Terminal 2: $ curl -v -X PUT http://127.0.0.1:7878/checkout/address 2 ↵ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > PUT /checkout/address HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 6 < Content-Type: text/plain < X-Request-ID: 2d1f738c-c091-4f34-990d-6ae7f82fb6d0 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 104 < Date: Mon, 12 Feb 2018 23:41:57 GMT > * Connection #0 to host 127.0.0.1 left intact update% ``` -------------------------------- ### Run and test path extraction example Source: https://github.com/gotham-rs/gotham/blob/main/examples/path/introduction/README.md Commands to start the Gotham example server and verify path extraction using curl. ```bash Terminal 1: $ cargo run Compiling gotham_examples_path_introduction v0.0.0 (file://.../gotham/examples/path/introduction) Finished dev [unoptimized + debuginfo] target(s) in 2.36 secs Running `.../gotham/target/debug/gotham_examples_path_introduction` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -vvv http://localhost:7878/products/t-shirt * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET /products/t-shirt HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 16 < Content-Type: text/plain < X-Request-ID: eb0457b0-a38e-4b8b-afb2-e2f3d9f1010e < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 81 < Date: Sat, 17 Feb 2018 05:21:31 GMT < * Connection #0 to host localhost left intact Product: t-shirt% ``` -------------------------------- ### Run Gotham middleware example Source: https://github.com/gotham-rs/gotham/blob/main/examples/middleware/introduction/README.md Execute the middleware introduction example using cargo. ```bash Terminal 1: $ cargo run Compiling gotham_examples_middleware_introduction v0.0.0 (file://.../gotham/examples/middleware/introduction) Finished dev [unoptimized + debuginfo] target(s) in 2.56 secs Running `.../gotham/target/debug/gotham_examples_middleware_introduction` Listening for requests at http://127.0.0.1:7878 ``` -------------------------------- ### Running the Hello World Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/hello_world_until/README.md Shows the commands to run the example in two terminals and how to interact with it using curl. Demonstrates graceful shutdown on Ctrl+C. ```bash Terminal 1: $ cargo run Compiling hello_world (file:///.../examples/hello_world) Finished dev [unoptimized + debuginfo] target(s) in 4.26 secs Running "../hello_world" Listening for requests at http://127.0.0.1:7878 Press Ctrl+C to exit ``` ```bash Terminal 2: $ curl -v http://127.0.0.1:7878/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 12 < Content-Type: text/plain < X-Request-ID: 88ec311c-fc77-4d2e-b302-b1ba38718d96 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 51 < Date: Fri, 05 Jan 2018 06:25:00 GMT < * Connection #0 to host 127.0.0.1 left intact Hello World!% ``` ```bash Terminal 1 again: Ctrl+C pressed Shutting down gracefully ``` -------------------------------- ### Running the IntoResponse Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/into_response/introduction/README.md This example shows how to run the Gotham IntoResponse introduction example and interact with it using curl. It demonstrates the server output and the client request/response. ```bash Terminal 1: $ cargo run Compiling gotham_examples_into_response_introduction v0.0.0 (file://.../gotham/examples/into_response/introduction) Finished dev [unoptimized + debuginfo] target(s) in 2.35 secs Running `.../gotham/target/debug/gotham_examples_into_response_introduction` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://localhost:7878/products/t-shirt * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET /products/t-shirt HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 18 < Content-Type: application/json < X-Request-ID: caa738c3-7467-42d0-b950-2c7b17643b22 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 140 < Date: Sun, 18 Feb 2018 00:03:17 GMT < * Connection #0 to host localhost left intact {"name":"t-shirt"}% ``` -------------------------------- ### Run Session Example and Interact via Curl Source: https://github.com/gotham-rs/gotham/blob/main/examples/sessions/introduction/README.md Commands to start the Gotham session example server and verify session persistence using curl with a cookie jar. ```bash Terminal 1: $ cargo run 130 ↵ Compiling gotham_examples_session_introduction v0.0.0 (file://.../gotham/examples/session/introduction) Finished dev [unoptimized + debuginfo] target(s) in 2.49 secs Running `.../gotham/target/debug/gotham_examples_cookies_introduction` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v -c /tmp/cookiejar http://localhost:7878 * Rebuilt URL to: http://localhost:7878/ * Trying ::1... * TCP_NODELAY set * Connection failed * connect to ::1 port 7878 failed: Connection refused * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 44 < Content-Type: text/plain < X-Request-ID: e9992f1d-9120-4473-be3e-60085098fb27 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff * Added cookie _gotham_session="rU4d0wvS1FO16jJ_pEzqrAYot6jcqrtpy8wDKEqwjuYbbgzunagwGA0h0kd6qH-cLwYlaGr3gOOxJEKmFa2pSg" for domain localhost, path /, expire 0 < Set-Cookie: _gotham_session=rU4d0wvS1FO16jJ_pEzqrAYot6jcqrtpy8wDKEqwjuYbbgzunagwGA0h0kd6qH-cLwYlaGr3gOOxJEKmFa2pSg; HttpOnly; SameSite=Lax; Path=/ < X-Runtime-Microseconds: 479 < Date: Wed, 28 Feb 2018 23:16:05 GMT < You have visited this page 0 time(s) before * Connection #0 to host localhost left intact $ curl -v -b /tmp/cookiejar http://localhost:7878 * Rebuilt URL to: http://localhost:7878/ * Trying ::1... * TCP_NODELAY set * Connection failed * connect to ::1 port 7878 failed: Connection refused * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.0 > Accept: */* > Cookie: _gotham_session=rU4d0wvS1FO16jJ_pEzqrAYot6jcqrtpy8wDKEqwjuYbbgzunagwGA0h0kd6qH-cLwYlaGr3gOOxJEKmFa2pSg > < HTTP/1.1 200 OK < Content-Length: 44 < Content-Type: text/plain < X-Request-ID: 788c055a-293b-49da-986f-d0afed9015fb < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 320 < Date: Wed, 28 Feb 2018 23:16:38 GMT < You have visited this page 1 time(s) before * Connection #0 to host localhost left intact ``` -------------------------------- ### Run Gotham TLS Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/openssl/README.md Execute the example application from the openssl directory. ```bash Terminal 1: $ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.24s Running `/home/judson/dev/gotham/target/debug/gotham_examples_hello_world_tls` Listening for requests at https://127.0.0.1:7878 ``` -------------------------------- ### Run Gotham TLS Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/hello_world_tls/README.md Execute the example application using cargo. ```bash $ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.24s Running `/home/judson/dev/gotham/target/debug/gotham_examples_hello_world_tls` Listening for requests at http://127.0.0.1:7878 ``` -------------------------------- ### Run Gotham Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/example_contribution_template/name/README.md Demonstrates the terminal commands to compile and execute a Gotham example crate and verify the server response. ```bash Terminal 1: $ cargo run Compiling gotham_examples_functionality_name v0.0.0 (file://.../gotham/examples/functionality/name) Finished dev [unoptimized + debuginfo] target(s) in 2.56 secs Running `.../gotham/target/debug/gotham_examples_functionality_name` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878 ... ``` -------------------------------- ### Run Request Data Handler Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/handlers/request_data/README.md Execute the request_data example to view server-side logging of incoming HTTP requests. ```bash Terminal 1: $ cargo run Compiling handlers/request_data (file:///.../examples/handlers/request_data) Finished dev [unoptimized + debuginfo] target(s) in 4.26 secs Running `../handlers/request_data` Listening for requests at http://127.0.0.1:7878 Method: Get URI: "/" HTTP Version: Http11 Headers: {"Host": "localhost:7878", "User-Agent": "curl/7.58.0", "Accept": "*/*"} Method: Post URI: "/" HTTP Version: Http11 Headers: {"Host": "localhost:7878", "User-Agent": "curl/7.58.0", "Accept": "*/*", "Content-Length": "19", "Content-Type": "application/x-www-form-urlencoded"} Body: {'test':'it works'} ``` -------------------------------- ### Run Gotham Hello World Source: https://github.com/gotham-rs/gotham/blob/main/examples/hello_world/README.md Execute the example application using cargo. ```bash Terminal 1: $ cargo run Compiling gotham_examples_hello_world (file:///.../examples/hello_world) Finished dev [unoptimized + debuginfo] target(s) in 4.26 secs Running `../gotham_examples_hello_world` Listening for requests at http://127.0.0.1:7878 ``` -------------------------------- ### Running the Askama Templating Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/templating/askama/README.md This shows the commands to compile and run the Gotham Askama example, and how to test it with curl. It also displays the expected HTTP response. ```bash Terminal 1: $ cargo run Compiling gotham_examples_templating_askama (file:///.../examples/templating/tera) Finished dev [unoptimized + debuginfo] target(s) in 13.18s Running `../gotham_examples_templating_askama` Listening at 127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < x-request-id: fc67c641-e586-4f79-a972-6171efde6782 < content-type: text/html; charset=utf-8 < content-length: 165 < date: Sat, 08 Dec 2018 21:04:32 GMT < Hello, Gotham! Askama says: "Hello, Gotham!" * Connection #0 to host 127.0.0.1 left intact ``` -------------------------------- ### Run Gotham Websocket Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/websocket/README.md Execute the websocket example from the project directory using cargo. ```bash Terminal 1: $ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.09s Running `.../gotham/target/debug/websocket` Listening on http://127.0.0.1:7878/ ``` -------------------------------- ### Run Tera example Source: https://github.com/gotham-rs/gotham/blob/main/examples/templating/tera/README.md Commands to execute the Tera example and verify the response via curl. ```bash Terminal 1: $ cargo run Compiling gotham_examples_templating_tera (file:///.../examples/templating/tera) Finished dev [unoptimized + debuginfo] target(s) in 4.26 secs Running `../gotham_examples_templating_tera` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 150 < Content-Type: text/html < X-Request-ID: 181d26c4-ee9d-44ed-aa52-803b10560d71 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 5437 < Date: Tue, 10 Jul 2018 15:37:58 GMT < Gotham Tera example

Hello Gotham!

* Connection #0 to host 127.0.0.1 left intact ``` -------------------------------- ### Running the Shared State Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/shared_state/README.md Instructions for running the shared state example in Gotham. This involves compiling and running the example, and then using curl to send requests to the running server. ```bash Terminal 1: $ cargo run Compiling gotham_examples_shared_state (file:///.../examples/shared_state) Finished dev [unoptimized + debuginfo] target(s) in 4.26 secs Running `../gotham_examples_shared_state` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Type: text/plain < Content-Length: 22 < X-Request-ID: b3fd0952-31f9-4872-8bbd-7fd6c07a0589 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 165 < Date: Sun, 15 Jul 2018 00:39:41 GMT < * Connection #0 to host 127.0.0.1 left intact Hello from request #1! $ curl -v http://127.0.0.1:7878/ * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Type: text/plain < Content-Length: 22 < X-Request-ID: 546d24e4-d7ad-4d69-be68-4e55cc4b9b96 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 118 < Date: Sun, 15 Jul 2018 00:39:44 GMT < * Connection #0 to host 127.0.0.1 left intact Hello from request #2! ``` -------------------------------- ### Run Multipart Form Parsing Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/handlers/multipart/README.md Instructions for running the multipart form parsing example using Cargo and testing it with curl. ```bash Terminal 1: $ cargo run Compiling handlers/multipart (file:///.../examples/handlers/multipart) Finished dev [unoptimized + debuginfo] target(s) in 4.26 secs Running `../handlers/multipart` Listening for requests at http://127.0.0.1:7878 ``` ```bash Terminal 2: $curl -H "Content-Type: multipart/form-data; boundary=--abcdef1234" -d "--abcdef1234\r\nContent-Disposition: form-data; name=foo\r\n\r\nbar\r\n\--abcdef1234--\r\n" http://127.0.0.1:7878 bar ``` -------------------------------- ### Run Gotham Router Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/routing/http_verbs/README.md Commands to execute the routing example and verify the response using curl. ```bash Terminal 1: $ cargo run 101 ↵ Compiling gotham_examples_routing_verbs v0.0.0 (file:///.../examples/routing/http_verbs) Finished dev [unoptimized + debuginfo] target(s) in 2.59 secs Running `.../target/debug/gotham_examples_routing_http_verbs` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878/products * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET /products HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 5 < Content-Type: text/plain < X-Request-ID: f25a879f-64d0-4415-9b33-3145137b0f01 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 147 < Date: Sun, 11 Feb 2018 22:46:00 GMT < * Connection #0 to host 127.0.0.1 left intact index% ``` -------------------------------- ### Running the Path Extraction Glob Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/path/globs/README.md Instructions for running the Gotham path extraction glob example. This involves compiling and running the example code, then using curl to send requests to different URL paths to observe the extracted segments. ```bash Terminal 1: $ cargo run Compiling gotham_examples_path_globs v0.0.0 (file://.../gotham/examples/path/globs) Finished dev [unoptimized + debuginfo] target(s) in 2.36 secs Running `.../gotham/target/debug/gotham_examples_path_globs` Listening for requests at http://127.0.0.1:7878 ``` ```bash Terminal 2: $ curl -vvv http://localhost:7878/parts/heads/shoulders/knees/toes * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET /parts/heads/shoulders/knees/toes HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 39 < Content-Type: text/plain < X-Request-ID: 3889c405-bb05-43f7-b717-c3eba2ed27fc < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 165 < Date: Mon, 19 Mar 2018 22:17:17 GMT < Got 4 parts: heads shoulders knees * Connection #0 to host localhost left intact toes ``` ```bash curl -vvv http://localhost:7878/middle/heads/shoulders/knees/toes/foobar * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET /middle/heads/shoulders/knees/toes/foobar HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < x-request-id: 8449a2ed-2b00-4fbf-98af-63e17d65a345 < content-type: text/plain < content-length: 39 < date: Sat, 23 May 2020 09:00:40 GMT < Got 4 parts: heads shoulders knees * Connection #0 to host localhost left intact toes ``` ```bash curl -vvv http://localhost:7878/multi/heads/shoulders/foobar/knees/toes * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET /multi/heads/shoulders/foobar/knees/toes HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < x-request-id: 4cbcf782-9dbb-4fcd-b12e-55661d3309a4 < content-type: text/plain < content-length: 72 < date: Sat, 23 May 2020 09:09:51 GMT < Got 2 parts for top: heads shoulders Got 2 parts for bottom: knees * Connection #0 to host localhost left intact toes ``` -------------------------------- ### Run Gotham Finalizer Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/finalizers/README.md Commands to compile and execute the finalizer example, followed by a curl request to trigger a 404 response. ```bash Terminal 1: $ cargo run Compiling gotham_examples_finalizer v0.0.0 (/ssd/upstream/gotham/examples/finalizers) Finished dev [unoptimized + debuginfo] target(s) in 6.00s Running `/ssd/upstream/gotham/target/debug/gotham_examples_finalizer` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878/no_such_path * Trying 127.0.0.1:7878... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET /no_such_path HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.65.3 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 404 Not Found < x-request-id: 3853acd7-e2b6-4a21-92a0-c33c403d4f28 < content-length: 32 < date: Wed, 04 Mar 2020 12:20:33 GMT < * Connection #0 to host 127.0.0.1 left intact The status code is 404 Not Found ``` -------------------------------- ### Run and Test Gotham Scopes Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/routing/scopes/README.md Commands to compile and run the routing scopes example, followed by a curl request to verify the endpoint. ```bash Terminal 1: Compiling gotham_examples_routing_scopes v0.0.0 (file://.../examples/routing/scopes) Finished dev [unoptimized + debuginfo] target(s) in 2.57 secs Running `.../target/debug/gotham_examples_routing_scopes` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://127.0.0.1:7878/checkout/start * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 7878 (#0) > GET /checkout/start HTTP/1.1 > Host: 127.0.0.1:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 5 < Content-Type: text/plain < X-Request-ID: 4e90411d-aab5-4568-9f4d-0c4086a42c1a < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 87 < Date: Mon, 12 Feb 2018 10:54:12 GMT < * Connection #0 to host 127.0.0.1 left intact start% ``` -------------------------------- ### Running the Query String Extraction Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/query_string/introduction/README.md Demonstrates how to compile and run the Gotham query string extraction example, including a sample curl command to test the endpoint and its expected JSON response. ```bash Terminal 1: $ cargo run 130 ↵ Compiling gotham_examples_query_string_introduction v0.0.0 (file://.../gotham/examples/query_string/introduction) Finished dev [unoptimized + debuginfo] target(s) in 2.49 secs Running `.../gotham/target/debug/gotham_examples_query_string_introduction` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v http://localhost:7878/products\?name\=t-shirt * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET /products?name=t-shirt HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.1 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 18 < Content-Type: application/json < X-Request-ID: 561c8c45-9945-4b01-ba8d-066a44761686 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Runtime-Microseconds: 170 < Date: Sat, 17 Feb 2018 10:33:05 GMT < * Connection #0 to host localhost left intact {"name":"t-shirt"}% ``` -------------------------------- ### Retrieve All Products After Creation Source: https://github.com/gotham-rs/gotham/blob/main/examples/diesel/README.md Send a GET request to the root endpoint again to retrieve all products. The previously created product is now listed. ```bash curl -v localhost:7878 * Connected to localhost (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.64.0 > Accept: */* > < HTTP/1.1 200 OK < x-request-id: 28a3cd70-d781-4671-b52f-67d096e38a79 < content-type: application/json < content-length: 63 < date: Thu, 11 Apr 2019 13:54:10 GMT < * Connection #0 to host localhost left intact [{"id":1,"title":"test","price":1.0,"link":"http://localhost"}]% ``` -------------------------------- ### Running Gotham Cookies Example Source: https://github.com/gotham-rs/gotham/blob/main/examples/cookies/introduction/README.md Demonstrates how to run the Gotham cookies example and interact with it using curl to set and retrieve cookies. Ensure the server is running in one terminal and curl commands are executed in another. ```bash Terminal 1: $ cargo run 130 ↵ Compiling gotham_examples_cookies_introduction v0.0.0 (file://.../gotham/examples/cookies/introduction) Finished dev [unoptimized + debuginfo] target(s) in 2.49 secs Running `.../gotham/target/debug/gotham_examples_cookies_introduction` Listening for requests at http://127.0.0.1:7878 Terminal 2: $ curl -v -c /tmp/cookiejar http://localhost:7878/ * Trying ::1... * TCP_NODELAY set * Connection failed * connect to ::1 port 7878 failed: Connection refused * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 25 < Content-Type: text/plain < X-Request-ID: 1b0ace7a-8d6b-478b-a099-f3e57363d9cd < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff * Added cookie adjective="repeat" for domain localhost, path /, expire 0 < Set-Cookie: adjective=repeat; HttpOnly < X-Runtime-Microseconds: 65 < Date: Wed, 07 Mar 2018 00:05:27 GMT < Hello first time visitor * Connection #0 to host localhost left intact $ curl -v -b /tmp/cookiejar http://localhost:7878/ * Trying ::1... * TCP_NODELAY set * Connection failed * connect to ::1 port 7878 failed: Connection refused * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 7878 (#0) > GET / HTTP/1.1 > Host: localhost:7878 > User-Agent: curl/7.54.0 > Accept: */* > Cookie: adjective=repeat > < HTTP/1.1 200 OK < Content-Length: 21 < Content-Type: text/plain < X-Request-ID: cc9c1e59-75ea-40e1-b511-98851c393cb9 < X-Frame-Options: DENY < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff * Replaced cookie adjective="repeat" for domain localhost, path /, expire 0 < Set-Cookie: adjective=repeat; HttpOnly < X-Runtime-Microseconds: 113 < Date: Wed, 07 Mar 2018 00:05:54 GMT < Hello repeat visitor * Connection #0 to host localhost left intact ```