1564990214
Rust** **is different. You can pick up Python or Ruby over the weekend, create a first CRUD application and be happy with the results.
With Rust you will struggle to pass a String to a different method, change and return it. You then will order the Rust book, see its size, sigh and get started.
After a few weeks of fighting through the book after work, you give up and wait until someone else creates an easy-to-follow tutorial.
I struggled with the same problems. Life circumstances however gave me a few months time on my hands to really focus on Rust.
What follows is a first overview, concept, and paths to follow. In the coming weeks and months, I’ll publish a series of articles to help you to get from concept to product.
After installing them (I chose brew for macOS in this example, the method doesn’t matter), the underlying stack looks different. NodeJS needs V8, the runtime engine from Google, and bindings to the JavaScript library to run JavaScript code.
Rust depends almost completely on Rust itself. Just the compiler is using llvm
libraries, which are written in C and C++.
It was and is a design decision not to include a standard http library in Rust. The OSI layer is therefore covered differently:
Node covers the whole stack, and offers with Koa and Express, two well-known and “rock-solid” web frameworks which help you to build applications on top of HTTP.
On the Rust side of things, just TCP is implemented in the Rust Core. The current web frameworks (actix and rocket) are implementing everything up until HTTP though. So you don’t need to care where this is coming from.
If you want to use pure HTTP calls without any larger framework, you can install “crates” (equivalent to npm packages in the Node world) which implement the HTTP protocol (like hyper and tiny_http).
Node is using npm for its package management:
npm install
is installing dependenciesnpm run xyz
is executing scripts inside the package.json
On the Rust side, cargo
is handling everything related to your project:
cargo new NAME --bin
is creating an applicationcargo new NAME --lib
to create a librarycargo run
is executing the codecargo build
is creating an executablecargo test
is running all tests inside the projectThere is an open PR to add cargo add
to install dependencies. Right now you have to add them by hand to your Cargo.toml
file. As you see, you don’t need to include scripts in a package.json
to run tests or build and test your application.
Mindset change: Cargo is fetching the packages after
cargo run
, and just if the version changed. So the first time it will fetch all packages, the second time just when a change in the version number happened. Unlikenpm i
which fetches the packages right away, and will add it to thepackage.json
with thesave
notation.### Ecosystem
Node is not successful for no reason. The ecosystem is rich and flourishing. Rust is still developing, but has already many great “crates”. The website arewewebyet.org is tracking the progress and showing you interesting packages in the Rust world.
There is also an attempt to create an official Rust Web Framework, called Tide. It is already pretty mature and can be used for side projects. Feel free to contribute and help craft a great environment for web development in Rust.
Nodes killer feature are Promises. Although not always easy to understand and handle, Promises and the event loop are what makes Node so lucrative.
Rust is also implementing an asynchronous mechanism, which are not yet in the final version. They are called Futures. A library called Tokio is already offering an asynchronous run time. You can track the progress on asynchronous programming in Rust over at areweasyncyet.
curl <a href="https://sh.rustup.rs" target="_blank">https://sh.rustup.rs</a> -sSf | sh
cargo new web-app --bin
cd web-app
Now you can choose your web framework of choice. You can either start with rocket or actix. You can follow the tutorials on the website to get a first web application running.
To not to get frustrated until my next post, here are the main four things about Rust you will have to get used to (which are quite awesome after a while).
.unwrap()
results to get the String out of the encapsulation. Homework: Try to check if the GET request errored and return an Error in this case instead of Ok().fetch_text()
is not taking ownership over the url but just using a reference to it (via the &
). Homework: Figure out why this code here fails and how to solve it.reqwest
is returning a Response struct (type) which implements certain methods. The documentation is, as with so many crates, excellent. So have a look here.return
to return a value from a method. Just don’t put a ;
at the end of a statement and this becomes your return value.Use this example to play around, see where you can get errors and learn to fix them.
Two opinions:
You actually have to learn a decent amount of Rust to get started. This is what I am here for. In the next few days, weeks and months I will cover the basics up until creating a solid web application.
Up until then, I can recommend the Rust track on Exercism.io and the Rust Book which you can find also in a paper version at your local book store or at Amazon.
As mentioned in my first article, Rust is making you a better developer, so the road will be long at times, but always worth it.
========================================
Thanks for reading :heart: If you liked this post, share it with all of your programming buddies! Follow me on Facebook | Twitter
☞ The Rust Programming Language
☞ Rust: Building Reusable Code with Rust from Scratch
☞ Programming in Rust: the good, the bad, the ugly.
☞ An introduction to Web Development with Rust for Node.js Developers
#node-js #rust
1619792740
We at ByteCipher have expert and skilled NodeJS developers dedicated to offer you a full spectrum of NodeJS app development services. ByteCipher is a well established NodeJS development company in USA & India and having solid experience in building dynamic and high data-driven apps with this light-weighted tool named Node.JS. For more information visit us at https://bit.ly/3eNewaZ
#nodejs development company in usa #nodejs web development company #nodejs developers india #top node js web development company india #node js development company in india #web-development
1597736283
Looking to build dynamic, extensively featured, and full-fledged web applications?
Hire NodeJs Developer to create a real-time, faster, and scalable application to accelerate your business. At HourlyDeveloper.io, we have a team of expert Node.JS developers, who have experience in working with Bootstrap, HTML5, & CSS, and also hold the knowledge of the most advanced frameworks and platforms.
Contact our experts: https://bit.ly/3hUdppS
#hire nodejs developer #nodejs developer #nodejs development company #nodejs development services #nodejs development #nodejs
1623498517
AppClues Infotech is one of the leading NodeJS app development company in USA that offering excellent NodeJS development services for web app development. We provide customized and high-quality NodeJS app development services to clients for different industries with advanced technology and functionalities.
Our dedicated app developers have years of experience in NodeJS development and thus successfully deliver cost-effective and highly customized solutions using the robust JavaScript engine of NodeJS.
Why Choose AppClues Infotech for NodeJS Application Development?
• Fast App Development
• Real-Time Application
• JSON (JavaScript Object Notation) in your Database
• Single Codebase
• Lower Cost
• Built-in NPM Support
• Inexpensive Testing and Hosting
For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910
#top nodejs app development company in usa #nodejs web app development #nodejs development agency in usa #hire nodejs app developers in usa #custom nodejs app development company #best nodejs app development service company
1627274472
Web app represents the particular firm or organization for which it is developed. With the help of a web app, the firm owner can promote and increase their business by reaching more and more customers for their website or web app.
Every firm or organization must have its own web app to represent their company, what they do, what they provide users feedback, and a lot more. If you have your web app then users can know your company deeply and they can also show interest in your company.
To develop a unique web app contact Nevina Infotech that is the best web application development services provider company, that can help you to develop the web app for your firm as per your requirement.
#web application development company #web application development services #web app development company #custom web application development company #web app development services #web application development agency
1626238039
A web app is the best way to promote their business for startups. You can’t verbally go and tell everyone to visit your company, but your website or web app can do that. A web app can represent your company, and the visitors who are visiting your website or web app will get knowledge about your firm. Doing this can help you to increase your customer rate.
Nevina Infotech is the best web app development company to choose for developing your web app for your startup. We have a great team of web developers to work with. Our developers are dedicated and enthusiastic in their work.
#web application development company #web application development services #web app development company #custom web application development company #web app development services #custom web application development services