#### What Will I Learn? - You will learn how to build routes using declarative macros with Rust's Rocket library - You will learn how to build and consume JSON structures in Rust - You will learn how to query JSON through HTTP methods and routes using Postman #### Requirements - A moderate understanding of the Rust programming language - A basic understanding of JavaScript Object Notation *(JSON)* - A basic understanding of Hypertext Transfer Protocol *(HTTP)* - A moderate understanding of what Macros are in programming #### Difficulty - Intermediate #### Description In this video, we finish the Rust side of our **API project**. We use various **declarative macros** to build the routes that we need to produce and consume **JSON**. We also use a JSON macro to format the JSON in our application properly. We connect our Database pool and our Routes so that we can convert the JSON into data that our database can read. We also serve our database data as JSON on our API endpoints. We also briefly look at how we can catch different patterns using the **Rocket Catcher! macro** which allows us to catch basic HTTP errors such as *404 resource not found*. This ground work will allow us to move forward and build a *front-end* using the **Elm programming language**. The source code for this project can be found [here](https://github.com/tensor-programming/rust_api_part_3) #### Video Tutorial <iframe width="560" height="315" src="https://www.youtube.com/embed/GKXCLc8F7nA" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> #### Curriculum - [Building a REST API in Rust (Part 1)](https://utopian.io/u/25955343) - [Building a REST API in Rust (Part 2)](https://utopian.io/u/26156255) <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@tensor/building-a-rest-api-in-rust-part-3">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
author | tensor | ||||||
---|---|---|---|---|---|---|---|
permlink | building-a-rest-api-in-rust-part-3 | ||||||
category | utopian-io | ||||||
json_metadata | {"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":724712,"name":"rust","full_name":"rust-lang/rust","html_url":"https://github.com/rust-lang/rust","fork":false,"owner":{"login":"rust-lang"}},"pullRequests":[],"platform":"github","type":"video-tutorials","tags":["utopian-io","steemstem","steemiteducation","programming","technology"],"links":["https://github.com/tensor-programming/rust_api_part_3","https://utopian.io/u/25955343","https://utopian.io/u/26156255"],"moderator":{"account":"ewq","time":"2018-01-18T14:37:12.264Z","reviewed":true,"pending":false,"flagged":false}} | ||||||
created | 2018-01-18 02:46:06 | ||||||
last_update | 2018-01-18 14:37:12 | ||||||
depth | 0 | ||||||
children | 4 | ||||||
last_payout | 2018-01-25 02:46:06 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 29.914 HBD | ||||||
curator_payout_value | 12.713 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 1,915 | ||||||
author_reputation | 87,856,203,149,624 | ||||||
root_title | "Building a REST API in Rust (Part 3)" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 30,302,195 | ||||||
net_rshares | 6,357,905,545,058 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
pharesim | 0 | 95,503,693,918 | 0.02% | ||
lafona-miner | 0 | 162,431,915,323 | 2.5% | ||
kushed | 0 | 4,873,688,293 | 2% | ||
bue | 0 | 83,091,320,439 | 100% | ||
mrs.agsexplorer | 0 | 5,731,726,551 | 2% | ||
anwenbaumeister | 0 | 38,545,065,508 | 2% | ||
roelandp | 0 | 86,524,643,210 | 1% | ||
toxichan | 0 | 451,859,873 | 2% | ||
timsaid | 0 | 4,969,962,926 | 1% | ||
velourex | 0 | 3,226,909,343 | 2% | ||
freyman | 0 | 10,600,729,826 | 70% | ||
lemouth | 0 | 17,036,607,370 | 5% | ||
steemedia | 0 | 213,319,003 | 2% | ||
curie | 0 | 92,955,113,459 | 2% | ||
cebymaster | 0 | 265,555,711 | 2% | ||
hendrikdegrote | 0 | 1,032,054,203,003 | 2.4% | ||
steemstem | 0 | 54,672,607,666 | 5% | ||
cotidiana | 0 | 237,487,749 | 2% | ||
teofilex11 | 0 | 1,234,074,236 | 2% | ||
thevenusproject | 0 | 2,391,027,311 | 5% | ||
dna-replication | 0 | 2,498,731,924 | 10% | ||
pacokam8 | 0 | 76,829,877 | 0.4% | ||
jamhuery | 0 | 1,689,163,708 | 5% | ||
mobbs | 0 | 5,832,428,804 | 2.5% | ||
bp423 | 0 | 477,147,502 | 2% | ||
trumpman | 0 | 10,708,885,735 | 11% | ||
diggerdugg | 0 | 201,668,805 | 2% | ||
alexander.alexis | 0 | 121,681,557 | 0.5% | ||
tensor | 0 | 9,335,013,333 | 100% | ||
fancybrothers | 0 | 891,939,410 | 3.5% | ||
ovij | 0 | 656,437,433 | 5% | ||
gamesjoyce | 0 | 334,281,815 | 2% | ||
somethingburger | 0 | 268,789,051 | 5% | ||
tormiwah | 0 | 433,109,785 | 3% | ||
gabox | 0 | 145,155,472 | 0.5% | ||
rscalabrini | 0 | 204,153,971 | 2% | ||
utopian-io | 0 | 4,598,201,742,818 | 2.88% | ||
kedi | 0 | 755,782,744 | 3.5% | ||
omstavan | 0 | 2,184,293,147 | 100% | ||
rayhanahmed | 0 | 871,649,076 | 100% | ||
robertlyon | 0 | 5,091,793,439 | 100% | ||
raci | 0 | 1,472,444,274 | 5% | ||
ongoingwow | 0 | 152,692,168 | 4% | ||
geekpowered | 0 | 2,084,704,854 | 1% | ||
steembasicincome | 0 | 2,995,286,295 | 2% | ||
rantar | 0 | 11,259,568,245 | 100% | ||
sco | 0 | 280,461,897 | 1% | ||
plaslistdercgat | 0 | 491,600,000 | 100% | ||
blervin | 0 | 617,425,383 | 100% | ||
progfu | 0 | 559,171,818 | 100% |
Thank you for the contribution. It has been approved. You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
author | ewq |
---|---|
permlink | re-tensor-building-a-rest-api-in-rust-part-3-20180118t143717084z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-01-18 14:37:18 |
last_update | 2018-01-18 14:37:18 |
depth | 1 |
children | 2 |
last_payout | 2018-01-25 14:37:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.255 HBD |
curator_payout_value | 0.412 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 172 |
author_reputation | 2,798,579,990,254 |
root_title | "Building a REST API in Rust (Part 3)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,408,361 |
net_rshares | 201,335,340,220 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tensor | 0 | 10,040,680,300 | 100% | ||
utopian.tip | 0 | 191,294,659,920 | 17.19% |
As always, thank you for watching my content.
author | tensor |
---|---|
permlink | re-ewq-re-tensor-building-a-rest-api-in-rust-part-3-20180118t173129995z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-01-18 17:31:27 |
last_update | 2018-01-18 17:31:27 |
depth | 2 |
children | 0 |
last_payout | 2018-01-25 17:31:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 45 |
author_reputation | 87,856,203,149,624 |
root_title | "Building a REST API in Rust (Part 3)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,442,761 |
net_rshares | 0 |
Hey @ewq, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!
author | utopian.tip |
---|---|
permlink | re-re-tensor-building-a-rest-api-in-rust-part-3-20180118t143717084z-20180118t165433 |
category | utopian-io |
json_metadata | "" |
created | 2018-01-18 16:54:33 |
last_update | 2018-01-18 16:54:33 |
depth | 2 |
children | 0 |
last_payout | 2018-01-25 16:54:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 153 |
author_reputation | 238,310,597,885 |
root_title | "Building a REST API in Rust (Part 3)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,435,552 |
net_rshares | 0 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
ewq | 0 | 0 | 100% |
### Hey @tensor I am @utopian-io. I have just upvoted you! #### Achievements - You have less than 500 followers. Just gave you a gift to help you succeed! - Seems like you contribute quite often. AMAZING! #### Community-Driven Witness! I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER! - <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a> - <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a> - Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a> [](https://steemit.com/~witnesses) **Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
author | utopian-io |
---|---|
permlink | re-tensor-building-a-rest-api-in-rust-part-3-20180118t150809566z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-01-18 15:08:09 |
last_update | 2018-01-18 15:08:09 |
depth | 1 |
children | 0 |
last_payout | 2018-01-25 15:08:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,082 |
author_reputation | 152,955,367,999,756 |
root_title | "Building a REST API in Rust (Part 3)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,414,799 |
net_rshares | 0 |