Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

web-backend-study

FastAPI と PostgreSQL を使った Web バックエンドの学習記録です。 ブラウザからデータベースまで、1つのリクエストがどう流れるかを、実際にアプリを動かしながらたどっています。

中身

フォルダ 内容
notes/ 学習ノート(Obsidian で読む想定。目次は 00_index.md)
minimal-fastapi-postgres-template/ 練習に使った FastAPI + PostgreSQL のテンプレート(下記の引用元を参照)
node_practice/ Node.js でブラウザの外から JavaScript を動かす練習

学んだこと

  1. ブラウザとサイト、フロントエンドとバックエンド
  2. HTTP のリクエストとレスポンス(メソッド、ヘッダー、ステータスコード)
  3. fetch とフォーム、リダイレクト、二重送信の防ぎ方
  4. JavaScript と実行環境(Node.js)
  5. FastAPI の仕組み(ルーティング、型チェック、Uvicorn)
  6. API・OpenAPI・Swagger UI
  7. データベース(ORM、制約、競合状態、トランザクション)
  8. PostgreSQL(SQL、索引、管理、権限、PL/pgSQL、ドライバ)→ notes/postgresql/

動かし方

Docker と uv が必要です。

cd minimal-fastapi-postgres-template
cp .env.example .env
docker compose up -d          # PostgreSQL を起動
uv sync                       # 依存パッケージを入れる
uv run alembic upgrade head   # テーブルを作る
uv run uvicorn app.main:app --reload --port 8000

Node.js の練習は、上のアプリを起動したまま次を実行します。

node node_practice/hello.js

引用元とライセンス

minimal-fastapi-postgres-template/ は、rafsaf/minimal-fastapi-postgres-template をコピーしたものです。 MIT ライセンス(Copyright (c) 2021 rafsaf)で公開されており、ライセンス全文は minimal-fastapi-postgres-template/LICENSE にそのまま残しています。

元のコードから変えたところは次のとおりです。

  • app/demo/:fetch とフォームの違いを見る練習ページを追加
  • app/main.py:練習ページを登録する2行を追加

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages