阅读了陈皓老师《左耳听风》栏目后,更觉个人知识体系停留在“知道”的阶段,真正动起手来,处处制肘。故决定重新上路,按照《左耳听风》的路线,锻炼一下自己。
个人博客建站,主要是为了熟悉一门前端与后端。这里选择使用社区日益活跃的Vue3作为个人博客的前端框架。Rust语言是一门系统级别语言,有着极为优秀的性能和内存安全。选择Rust作为后端语言: 一.因为个人对这个语言很喜欢,相信Rust在未来的5年内会像Go一样获取广泛应用(尽管Rust的学习曲线极其陡峭)。二.对Java等语言有一定基础,想通过个人博客这个项目,进一步学习Rust语言。
We call Actix Web a powerful and pragmatic framework. For all intents and purposes it’s a micro-framework with a few twists.
This makes it useful for building small services ready for production.
actix-web,是一个轻量级,高效率,适合简单项目的库。这也正是我们需要的。
所以引入actix-web库到项目中
#cargo.toml
[dependencies]
actix-web = "4"
编写一个hello,world
use actix_web::{get,App,HttpServer,Responder};#[get("/")]
async fn greet() -> impl Responder {format!("Hello World!")
}#[actix_web::main]
async fn main() -> std::io::Result<()> {HttpServer::new(|| {App::new().service(greet)}).bind(("127.0.0.1",8080))?.run().await
}
基本环境配置:
nodejs官网: https://nodejs.org/zh-cn/
vue官网: https://cn.vuejs.org/
项目环境配置
项目创建时,勾选vue router和pinia
npm init vue@latest
cd
#
npm i
npm run build
vue3当前的配置是非常简单的。到这一步基本的开发环境已经完成✅。接下来准备分析需求。进行开发。