Building a REST API in Rust (Part 1) by tensor

View this thread on steempeak.com
· @tensor · (edited)
$45.36
Building a REST API in Rust (Part 1)
#### What Will I Learn?

- You will learn how to use the Diesel ORM to build a schema
- You will learn a way of connecting a Rust project to an SQL Database
- You will learn how to properly build data models which implement code generation macros that create SQL

#### Requirements

- A moderate understanding of the Rust programming language 
- A little knowledge of SQL and SQL databases
- A fair understanding of command lines/terminals and command line interfaces
- An understanding of environment variables

#### Difficulty

- Intermediate


#### Description
In this video, we start building a **REST API** in the **Rust Programming language**.  We use the **Diesel library** to build our database. We also explore different methods of *creating and migrating* our data models through the use of the **Diesel CLI** and the **Diesel macro system**.  Finally, we use the **Diesel library** to help build out **declarative functions** that allow us to *insert, update, delete and view* the data from our database.  These functions will eventually help us give this type of functionality to our API endpoint.    

The source code for this project can be found [here](https://github.com/tensor-programming/rust_api_part_1)

#### Video Tutorial
<iframe width="560" height="315" src="https://www.youtube.com/embed/VMZdGX9wC4g" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>


<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@tensor/building-an-rest-api-in-rust-part-1">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 16 others
properties (23)
post_id25,949,119
authortensor
permlinkbuilding-an-rest-api-in-rust-part-1
categoryutopian-io
json_metadata"{"type": "video-tutorials", "repository": {"owner": {"login": "rust-lang"}, "id": 724712, "full_name": "rust-lang/rust", "fork": false, "name": "rust", "html_url": "https://github.com/rust-lang/rust"}, "pullRequests": [], "format": "markdown", "links": ["https://github.com/tensor-programming/rust_api_part_1"], "app": "utopian/1.0.0", "moderator": {"pending": false, "account": "ewq", "reviewed": true, "flagged": false, "time": "2018-01-16T10:16:00.292Z"}, "platform": "github", "tags": ["utopian-io", "steemstem", "steemiteducation", "programming", "technology"], "community": "utopian", "users": ["tensor"]}"
created2018-01-16 02:50:45
last_update2018-01-17 02:56:54
depth0
children3
net_rshares6,010,084,952,677
last_payout2018-01-23 02:50:45
cashout_time1969-12-31 23:59:59
total_payout_value32.306 SBD
curator_payout_value13.049 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,575
author_reputation87,767,420,253,600
root_title"Building a REST API in Rust (Part 1)"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (80)
@ewq ·
$1.86
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)**
👍  
properties (23)
post_id26,005,198
authorewq
permlinkre-tensor-building-an-rest-api-in-rust-part-1-20180116t101604105z
categoryutopian-io
json_metadata"{"app": "utopian/1.0.0", "community": "utopian", "tags": ["utopian-io"]}"
created2018-01-16 10:16:06
last_update2018-01-16 10:16:06
depth1
children1
net_rshares197,385,340,209
last_payout2018-01-23 10:16:06
cashout_time1969-12-31 23:59:59
total_payout_value1.395 SBD
curator_payout_value0.462 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length172
author_reputation2,121,615,436,892
root_title"Building a REST API in Rust (Part 1)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@utopian.tip ·
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!
properties (22)
post_id26,060,113
authorutopian.tip
permlinkre-re-tensor-building-an-rest-api-in-rust-part-1-20180116t101604105z-20180116t155725
categoryutopian-io
json_metadata{}
created2018-01-16 15:57:27
last_update2018-01-16 15:57:27
depth2
children0
net_rshares0
last_payout2018-01-23 15:57:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length153
author_reputation238,049,167,312
root_title"Building a REST API in Rust (Part 1)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
### 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>

[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](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**
properties (22)
post_id26,007,099
authorutopian-io
permlinkre-tensor-building-an-rest-api-in-rust-part-1-20180116t103106557z
categoryutopian-io
json_metadata"{"app": "utopian/1.0.0", "community": "utopian", "tags": ["utopian-io"]}"
created2018-01-16 10:31:06
last_update2018-01-16 10:31:06
depth1
children0
net_rshares0
last_payout2018-01-23 10:31:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,082
author_reputation152,913,012,544,965
root_title"Building a REST API in Rust (Part 1)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000