The Visual Studio Code Remote - Containers extension lets you use a Docker container as a full-featured development environment. This fixes the following problems
Install the devcontainer extension in VSCode and then setup a Rust environment.
We have pre-configured a development environment with all the tools needed to create a full stack rust application.
To get started create a folder for your project. Change directory into that folder then run.
mkdir project-name
cd project-name
| \
&&
| \
&&
Load the folder into visual studio code. On the bottom left corner of VS Code you should see a green icon. Click on this and select open in container.
After the container is downloaded you will have a preconfigured development environment with the following folder structure.
How you folder structure will look.
Open up a terminal in VSCode (CTRL + `) and execute
We are going to create a workspace for our web application. Create a new Cargo.toml
file in the root folder and add the following.
[]
= [
"crates/*",
]
Open up the terminal in VSCode again and run the following
$ cargo new --vcs=none crates/axum-server
Created binary (application) `crates/axum-server` package
You should now have a folder structure like the following.
Test out your development environment with
$ cargo run
Compiling app v0.1.0 (/workspace/app)
Finished dev [unoptimized + debuginfo] target(s) in 1.16s
Running `target/debug/app`
Hello, world!
From the /workspace
folder
$ git add .
$ git commit -m"Initial Commit"