Skip to content

moseskim/zero-to-production

 
 

Repository files navigation

Zero To Production In Rust

Zero To Production In Rust는 Rust를 사용한 백엔드 개발에 관한 주관적인 소개이다.

이 저장소는 이 책의 보충 자료로 제공된다. 책 전체에서 설명하는 이메일 뉴스레터 프로젝트의 코드 베이스 스냅샷을 담고 있다.

챕터별 스냅샷

main 브랜치는 책 마지막의 프로젝트를 나타낸다.

각 장 마지막의 프로젝트는 개별 브랜치를 전환해서 확인할 수 있다:

사전 준비

다음을 설치해야 한다:

다음은 OS별 요구 사항이다.

Windows

cargo install -f cargo-binutils
rustup component add llvm-tools-preview
cargo install --version="~0.6" sqlx-cli --no-default-features --features rustls,postgres

Linux

# Ubuntu 
sudo apt-get install lld clang libssl-dev postgresql-client
# Arch 
sudo pacman -S lld clang postgresql
cargo install --version="~0.6" sqlx-cli --no-default-features --features rustls,postgres

MacOS

brew install michaeleisel/zld/zld
cargo install --version="~0.6" sqlx-cli --no-default-features --features rustls,postgres

빌드 방법

도커를 경유해서 (마이그레이트 된) Postgres 데이터베이스를 기동한다:

./scripts/init_db.sh

도커를 경유해서 Reids 인스턴스를 기동한다:

./scripts/init_redis.sh

cargo를 기동한다:

cargo build

cargo run을 사용해서 웹 서버를 기동한 뒤, 브라우저에서 http://127.0.0.1:8000/login에 접근할 수 있다.

기본 admin 계정의 비밀번호는 everythinghastostartsomewhere이며, 접근할 수 있는 엔드포인트들은 src/startup.rs에 리스팅되어 있다.

테스트 방법

도커를 경유해서 (마이그레이트 된) Postgres 데이터베이스를 기동한다:

./scripts/init_db.sh

도커를 경유해서 Redis 인스턴스를 기동한다:

./scripts/init_redis.sh

Launch cargo:

cargo test 

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Code for "Zero To Production In Rust", a book on API development using Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 94.7%
  • Shell 2.9%
  • Other 2.4%