{"id":39511,"date":"2022-11-29T21:09:11","date_gmt":"2022-11-29T12:09:11","guid":{"rendered":"https:\/\/kinsta.com\/jp\/?p=39511&#038;preview=true&#038;preview_id=39511"},"modified":"2023-08-26T00:15:26","modified_gmt":"2023-08-25T15:15:26","slug":"fastapi","status":"publish","type":"post","link":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/","title":{"rendered":"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b"},"content":{"rendered":"<p>FastAPI \u306f\u3001<a href=\"https:\/\/kinsta.com\/blog\/python-object-oriented-programming\/\">Python <\/a>3.6\u4ee5\u964d\u3092\u4f7f\u7528\u3057\u305f\u30e2\u30c0\u30f3\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u69cb\u7bc9\u306b\u4fbf\u5229\u306a\u3001\u9ad8\u901f\u304b\u3064\u8efd\u91cf\u306e\u30a6\u30a7\u30d6\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u305d\u3093\u306aFastAPI \u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u69cb\u7bc9\u306e\u57fa\u672c\u3092\u8aac\u660e\u3057\u3001\u3053\u308c\u304c<a href=\"https:\/\/www.infoworld.com\/article\/3637038\/the-best-open-source-software-of-2021.html#slide5\" target=\"_blank\" rel=\"noopener noreferrer\">2021\u5e74\u30d9\u30b9\u30c8\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af<\/a>\u306e1\u3064\u3068\u3057\u3066\u30ce\u30df\u30cd\u30fc\u30c8\u3055\u308c\u305f\u7406\u7531\u306e\u4e00\u7aef\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>FastAPI\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3059\u308b\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\u3001\u30b5\u30fc\u30d0\u30fc\u9078\u3073\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002Kinsta\u306e<a href=\"https:\/\/sevalla.com\/application-hosting\/\">\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc<\/a>\u3068<a href=\"https:\/\/sevalla.com\/database-hosting\/\">\u30de\u30cd\u30fc\u30b8\u30c9\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc<\/a>\u30b5\u30fc\u30d3\u30b9\u306f\u3001Python\u306b\u5f37\u3044PaaS\uff08Platform as a Service\uff09\u3067\u3059\u3002\u662f\u975e\u3068\u3082\u3042\u308f\u305b\u3066\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u307e\u305a\u306f\u57fa\u672c\u304b\u3089\u5b66\u3073\u307e\u3057\u3087\u3046\u3002<\/p>\n<div><\/div><kinsta-auto-toc heading=\"Table of Contents\" exclude=\"last\" list-style=\"arrow\" selector=\"h2\" count-number=\"-1\"><\/kinsta-auto-toc>\n<h2>FastAPI\u306e\u5f37\u307f<\/h2>\n<p>\u306f\u3058\u3081\u306b\u3001<a href=\"https:\/\/fastapi.tiangolo.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">FastAPI\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af<\/a>\u304c\u5404\u7a2e\u958b\u767a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u3082\u305f\u3089\u3059\u5229\u70b9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>\u30b9\u30d4\u30fc\u30c9<\/strong>\uff1aFastAPI\u306f\u3001\u305d\u306e\u540d\u306e\u901a\u308a\u3001\u975e\u5e38\u306b\u9ad8\u901f\u306a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u305d\u306e\u901f\u3055\u306f\u3001\u4e00\u822c\u306bAPI\u69cb\u7bc9\u306e\u4e2d\u3067\u3082\u6700\u901f\u306e\u9078\u629e\u80a2\u3068\u79f0\u3055\u308c\u308b<a href=\"https:\/\/docs.sevalla.com\/templates\/overview\">Go<\/a>\u3084<a href=\"https:\/\/docs.sevalla.com\/templates\/overview\">Node.js<\/a>\u306b\u5339\u6575\u3057\u307e\u3059\u3002<\/li>\n<li><strong>\u5b66\u7fd2\u3068\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u304c\u5bb9\u6613<\/strong>\uff1aFastAPI\u3067\u306f\u3001API\u3092\u4e16\u306b\u9001\u308a\u51fa\u3059\u305f\u3081\u306b\u5fc5\u8981\u306a\u307b\u307c\u3059\u3079\u3066\u306e\u8981\u7d20\u304c\u7db2\u7f85\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3044\u3061\u3044\u3061\u30bc\u30ed\u304b\u3089\u3059\u3079\u3066\u3092\u8a18\u8ff0\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u308f\u305a\u304b\u6570\u884c\u306e\u30b3\u30fc\u30c9\u3067\u3001\u30c7\u30d7\u30ed\u30a4\u53ef\u80fd\u306aRESTful API\u3092\u7528\u610f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<li><strong>\u5305\u62ec\u7684\u306a\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/strong>\uff1aFastAPI\u306fOpenAPI\u3068\u3044\u3046\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u4ed5\u69d8\u3092\u63a1\u7528\u3057\u3066\u304a\u308a\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u52d5\u7684\u306b\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u3001FastAPI\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3001\u5fdc\u7b54\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u3001\u30ea\u30bf\u30fc\u30f3\u30b3\u30fc\u30c9\u3068\u3044\u3063\u305f\u8a73\u3057\u3044\u60c5\u5831\u304c\u8a18\u8f09\u3055\u308c\u307e\u3059\u3002<\/li>\n<li><strong>\u30d0\u30b0\u306e\u5c11\u306a\u3044API<\/strong>\uff1aFastAPI\u306f<a href=\"https:\/\/fastapi.tiangolo.com\/tutorial\/query-params-str-validations\/#add-more-validations\" target=\"_blank\" rel=\"noopener noreferrer\">\u30ab\u30b9\u30bf\u30e0\u30c7\u30fc\u30bf\u691c\u8a3c<\/a>\u3092\u30b5\u30dd\u30fc\u30c8\u3002\u30d0\u30b0\u306e\u5c11\u306a\u3044API\u3092\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002FastAPI\u306e\u63a1\u7528\u306b\u3088\u308a\u4eba\u70ba\u7684\u306a\u30d0\u30b0\u304c40%\u6e1b\u5c11\u3057\u305f\u4f8b\u3082\u898b\u3089\u308c\u308b\u307b\u3069\u3067\u3059\u3002<\/li>\n<li><strong>\u578b\u30d2\u30f3\u30c8<\/strong>\uff1aPython 3.5\u3067\u5c0e\u5165\u3055\u308c\u305f\u578b\u30d2\u30f3\u30c8\u306b\u3088\u308a\u3001\u5909\u6570\u306e<code>type<\/code>\u304c\u5ba3\u8a00\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u5909\u6570\u306e\u578b\u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308b\u3068\u3001IDE\u306b\u304a\u3051\u308b\u30b5\u30dd\u30fc\u30c8\u9762\u3067\u306e\u76f8\u6027\u304c\u9ad8\u307e\u308a\u3001\u3088\u308a\u6b63\u78ba\u306b\u30a8\u30e9\u30fc\u3092\u4e88\u6e2c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n<h2>FastAPI\u5229\u7528\u306e\u4e0b\u6e96\u5099<\/h2>\n<p>\u4eca\u56de\u306e\u8a18\u4e8b\u306e\u8aac\u660e\u306b\u6cbf\u3063\u3066FastAPI\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u5c11\u3057\u3060\u3051\u6e96\u5099\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/code.visualstudio.com\/download\" target=\"_blank\" rel=\"noopener noreferrer\">Visual Studio Code<\/a>\u306a\u3069\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5411\u3051\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\/IDE\u3092\u3054\u7528\u610f\u304f\u3060\u3055\u3044\u3002\u4ed6\u306b\u306f\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/how-to-use-sublime-text\/\" rel=\"noopener\">Sublime Text<\/a>\u3084<a href=\"https:\/\/www.espressoapp.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Espresso<\/a>\u306a\u3069\u3082\u304a\u3059\u3059\u3081\u3067\u3059\u3002<\/p>\n<p>Python\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u305d\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5b9f\u884c\u5834\u6240\u3068\u3057\u3066\u4eee\u60f3\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002\u4eee\u60f3\u74b0\u5883\u3067\u306f\u3001\u8907\u6570\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30bb\u30c3\u30c8\u3084\u69cb\u6210\u3092\u540c\u6642\u306b\u5b9f\u884c\u3057\u306a\u304c\u3089\u3001\u4e92\u63db\u6027\u306e\u306a\u3044\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u308b\u5e72\u6e09\u3092\u56de\u907f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/python-commands\/#introduction-to-the-cli\">\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u958b\u3044\u3066<\/a>\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">$ python3 -m venv env<\/code><\/pre>\n<p>\u307e\u305f\u3001\u4eee\u60f3\u74b0\u5883\u3092\u6709\u52b9\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u884c\u3046\u30b3\u30de\u30f3\u30c9\u306f\u3001\u4f7f\u7528\u3057\u3066\u3044\u308b\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u3084\u30b7\u30a7\u30eb\u306b\u3088\u308a\u7570\u306a\u308a\u307e\u3059\u3002\u5404\u74b0\u5883\u3067\u306e\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-bash\"># Unix\u307e\u305f\u306fMacOS\uff08bash\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff09: \n\/path\/to\/venv\/bin\/activate\n\n# Unix\u307e\u305f\u306fMacOS\uff08csh\u30b9\u30af\u30ea\u30d7\u30c8\uff09:\n\/path\/to\/venv\/bin\/activate.csh\n\n# Unix\u307e\u305f\u306fMacOS\uff08fish\u30b7\u30a7\u30eb\uff09:\n\/path\/to\/venv\/bin\/activate.fish\n\n# Windows\uff08\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\uff09:\npathtovenvScriptsactivate.bat\n\n# Windows\uff08PowerShell\uff09:\npathtovenvScriptsActivate.ps1\n<\/code><\/pre>\n<p>Python\u5bfe\u5fdcIDE\u306e\u4e2d\u306b\u306f\u3001\u4eee\u60f3\u74b0\u5883\u6709\u52b9\u5316\u306e\u8a2d\u5b9a\u304c\u3067\u304d\u308b\u3082\u306e\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u7d9a\u3044\u3066\u306f\u3001FastAPI\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">$ pip3 install fastapi<\/code><\/pre>\n<p>FastAPI\u306fAPI\u69cb\u7bc9\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u304c\u3001API\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u306f\u30ed\u30fc\u30ab\u30eb\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u958b\u767a\u306b\u4fbf\u5229\u306a\u9078\u629e\u80a2\u3068\u3057\u3066\u3001<a href=\"https:\/\/www.uvicorn.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Uvicorn<\/a>\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002Uvicorn\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">$ pip3 install \"uvicorn[standard]\"<\/code><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u6210\u529f\u3057\u305f\u3089\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b<strong>main.py<\/strong>\u3068\u3044\u3046\u540d\u524d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a8\u30f3\u30c8\u30ea\u30dd\u30a4\u30f3\u30c8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<figure style=\"width: 1151px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/fastapi-project-layout.png\" alt=\"IDE\u5185\u306e\u57fa\u672c\u7684\u306aFastAPI\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u69d8\u5b50\" width=\"1151\" height=\"475\"><figcaption class=\"wp-caption-text\">IDE\u5185\u306e\u57fa\u672c\u7684\u306aFastAPI\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u69d8\u5b50<\/figcaption><\/figure>\n<h3>FastAPI\u306e\u7c21\u5358\u306a\u4f8b<\/h3>\n<p>\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u4f8b\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u3001FastAPI\u3092\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\"># main.py\nfrom fastapi import FastAPI\napp = FastAPI()\n@app.get(\"\/\")\nasync def root():\n return {\"greeting\":\"Hello world\"}\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u306b\u3088\u308a\u3001\u57fa\u672c\u7684\u306aFastAPI\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u304c\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u8aac\u660e\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li><code>from fastapi import FastAPI<\/code>\uff1aAPI\u306e\u6a5f\u80fd\u304cFastAPI\u3068\u3044\u3046Python\u30af\u30e9\u30b9\u3067\u63d0\u4f9b\u3055\u308c\u308b<\/li>\n<li><code>app = FastAPI()<\/code>\uff1aFastAPI\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210<\/li>\n<li><code>@app.get(\"\/\")<\/code>\uff1aPython\u306e\u30c7\u30b3\u30ec\u30fc\u30bf\u3067\u3042\u308a\u3001FastAPI\u306b\u5bfe\u3057\u3066\u3001\u305d\u306e\u4e0b\u306e\u95a2\u6570\u304c\u30ea\u30af\u30a8\u30b9\u30c8\u51e6\u7406\u3092\u62c5\u5f53\u3059\u308b\u3053\u3068\u3092\u6307\u5b9a<\/li>\n<li><code>@app.get(\"\/\")<\/code>\uff1a\u30eb\u30fc\u30c8\u3092\u6307\u5b9a\u3059\u308b\u30c7\u30b3\u30ec\u30fc\u30bf\uff08\u30b5\u30a4\u30c8\u306e\u30eb\u30fc\u30c8\u3067<code>GET<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u6210\u3057\u3001\u30e9\u30c3\u30d7\u3055\u308c\u305f\u95a2\u6570\u306b\u3088\u308a\u7d50\u679c\u304c\u8fd4\u3055\u308c\u308b\uff09<\/li>\n<li>\u3053\u306e\u307b\u304b\u306b\u3082\u3001<code>@app.post()<\/code>\u3001<code>@app.put()<\/code>\u3001<code>@app.delete()<\/code>\u3001<code>@app.options()<\/code>\u3001<code>@app.head()<\/code>\u3001<code>@app.patch()<\/code>\u3001<code>@app.trace()<\/code>\u306e\u3088\u3046\u306a\u64cd\u4f5c\u3092\u884c\u3046\u3053\u3068\u304c\u53ef\u80fd<\/li>\n<\/ul>\n<p>\u30d5\u30a1\u30a4\u30eb\u306e\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057API\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">$ uvicorn main:app --reload<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306b\u3042\u308b<code>main<\/code>\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u540d\u524d\u3067\u3059\u3002<code>app<\/code>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u3042\u308a\u3001ASGI\u30b5\u30fc\u30d0\u30fc\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3055\u308c\u307e\u3059\u3002<code>--reload<\/code>\u306f\u3001\u4f55\u304b\u5909\u66f4\u3092\u52a0\u3048\u305f\u3068\u304d\u306b\u81ea\u52d5\u3067\u306e\u518d\u8aad\u307f\u8fbc\u307f\u3092\u30b5\u30fc\u30d0\u30fc\u306b\u6307\u793a\u3059\u308b\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u3067\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u306f\u4ee5\u4e0b\u304c\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<pre><code> $ uvicorn main:app --reload\nINFO: Will watch for changes in these directories: ['D:\\WEB DEV\\Eunit\\Tests\\fast-api']\nINFO: Uvicorn running on http:\/\/127.0.0.1:8000 (Press CTRL+C to quit)\nINFO: Started reloader process [26888] using WatchFiles\nINFO: Started server process [14956]\nINFO: Waiting for application startup.\nINFO: Application startup complete.\n<\/code><\/pre>\n<p>\u7d9a\u3044\u3066\u30d6\u30e9\u30a6\u30b6\u3067\u3001<code>http:\/\/localhost:8000<\/code>\u306b\u79fb\u52d5\u3057\u3066\u3001API\u304c\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002JSON\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u300c\u201cHello\u201d: \u201cWorld\u201d\u300d\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u6bb5\u968e\u3067\u3059\u3067\u306b\u3001FastAPI\u3092\u4f7f\u3063\u305fAPI\u306e\u4f5c\u6210\u304c\u3044\u304b\u306b\u7c21\u5358\u304b\u3092\u3054\u7406\u89e3\u3044\u305f\u3060\u3051\u305f\u306f\u305a\u3067\u3059\u3002\u4e0a\u8a18\u30b3\u30fc\u30c9\u306e6\u884c\u76ee\u306b\u3042\u308b\u3088\u3046\u306b\u3001\u30eb\u30fc\u30c8\u3092\u5b9a\u7fa9\u3057\u3001Python\u306e\u8f9e\u66f8\u3092\u8fd4\u3059\u3068\u3044\u3046\u64cd\u4f5c\u3092\u884c\u3046\u3060\u3051\u3067\u5b8c\u4e86\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<figure style=\"width: 900px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/fastapi-hello-world-in-browser.png\" alt=\"FastAPI\u3067Hello World\u3092\u8868\u793a\u3057\u3066\u307f\u308b\" width=\"900\" height=\"340\"><figcaption class=\"wp-caption-text\">FastAPI\u3067Hello World\u3092\u8868\u793a\u3057\u3066\u307f\u308b<\/figcaption><\/figure>\n<h3>\u578b\u30d2\u30f3\u30c8\u3092\u4f7f\u3046<\/h3>\n<p>Python\u3067\u306e\u30b3\u30fc\u30c9\u8a18\u8ff0\u306e\u7d4c\u9a13\u304c\u3042\u308c\u3070\u3001\u5909\u6570\u306b<code>int<\/code>\u3001<code>str<\/code>\u3001<code>float<\/code>\u3001<code>bool<\/code>\u306e\u3088\u3046\u306a\u57fa\u672c\u7684\u306a\u30c7\u30fc\u30bf\u578b\u3092\u4ed8\u3051\u308b\u3053\u3068\u306b\u306f\u6163\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002\u3057\u304b\u3057\u3001Python\u30d0\u30fc\u30b8\u30e7\u30f33.9\u304b\u3089\u306f\u3001\u9ad8\u5ea6\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u304c\u5c0e\u5165\u3055\u308c\u3066\u304a\u308a\u3001<code>dictionaries<\/code> \u3001<code>tuples<\/code> \u3001<code>lists<\/code> \u306a\u3069\u306e\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u306e\u4f5c\u696d\u304c\u53ef\u80fd\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002FastAPI\u306e\u578b\u30d2\u30f3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001<a href=\"https:\/\/pydantic-docs.helpmanual.io\/usage\/models\/\" target=\"_blank\" rel=\"noopener noreferrer\">pydantic<\/a>\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u306e\u30b9\u30ad\u30fc\u30de\u3092\u69cb\u6210\u3057\u3001\u30c7\u30fc\u30bf\u691c\u8a3c\u306e\u6069\u6075\u3092\u53d7\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u4f8b\u3067\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u98df\u4e8b\u306e\u4fa1\u683c\u8a08\u7b97\u6a5f<code>calculate_meal_fee<\/code>\u3092\u4f7f\u3063\u3066\u3001Python\u3067\u306e\u578b\u30d2\u30f3\u30c8\u306e\u4f7f\u3044\u65b9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\">def calculate_meal_fee(beef_price: int, meal_price: int) -&gt; int:\n total_price: int = beef_price + meal_price\n return total_price\nprint(\"Calculated meal fee\", calculate_meal_fee(75, 19))\n<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u578b\u30d2\u30f3\u30c8\u306b\u3088\u3063\u3066\u30b3\u30fc\u30c9\u306e\u6319\u52d5\u305d\u306e\u3082\u306e\u306f\u5909\u66f4\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<h3>FastAPI\u306e\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6API\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/h3>\n<p>FastAPI\u3067\u306f\u3001<a href=\"https:\/\/github.com\/swagger-api\/swagger-ui\" target=\"_blank\" rel=\"noopener noreferrer\">Swagger<\/a>\u3092\u4f7f\u7528\u3057\u305f\u81ea\u52d5\u3067\u306e\u5bfe\u8a71\u578bAPI\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u751f\u6210\u304c\u53ef\u80fd\u3067\u3059\u3002<code>http:\/\/localhost:8000\/docs<\/code>\u306b\u79fb\u52d5\u3059\u308b\u3068\u3001\u3059\u3079\u3066\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3001\u30e1\u30bd\u30c3\u30c9\u3001\u30b9\u30ad\u30fc\u30de\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<figure style=\"width: 900px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/swagger-ui-fastapi-documentation-interface.png\" alt=\"Swagger\u3092\u4f7f\u3063\u305fFastAPI\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\" width=\"900\" height=\"1013\"><figcaption class=\"wp-caption-text\">Swagger\u3092\u4f7f\u3063\u305fFastAPI\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/figcaption><\/figure>\n<p>\u3053\u306e\u30d6\u30e9\u30a6\u30b6\u30d9\u30fc\u30b9\u306eAPI\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306fFastAPI\u3067\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u3053\u308c\u306e\u7528\u610f\u3068\u3057\u3066\u7279\u5225\u306a\u64cd\u4f5c\u3092\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u30d9\u30fc\u30b9\u306eAPI\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u3001<a href=\"https:\/\/github.com\/Redocly\/redoc\" target=\"_blank\" rel=\"noopener noreferrer\">Redoc<\/a>\u3068\u3044\u3046\u9078\u629e\u80a2\u3082\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u3001<code>http:\/\/localhost:8000\/redoc<\/code>\u306b\u79fb\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3059\u308b\u3068\u3001\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3001\u30e1\u30bd\u30c3\u30c9\u3001\u304a\u3088\u3073\u305d\u308c\u305e\u308c\u306e\u5fdc\u7b54\u304c\u4e00\u89a7\u3067\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<figure style=\"width: 900px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/redoc-fastapi-documentation-interface.png\" alt=\"Redoc\u3092\u4f7f\u3063\u305fFastAPI\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\" width=\"900\" height=\"1112\"><figcaption class=\"wp-caption-text\">Redoc\u3092\u4f7f\u3063\u305fFastAPI\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/figcaption><\/figure>\n<h3>FastAPI\u3067\u306e\u30eb\u30fc\u30c8\u306e\u8a2d\u5b9a<\/h3>\n<p><code>@app<\/code>\u30c7\u30b3\u30ec\u30fc\u30bf\u3067\u306f\u3001\u30eb\u30fc\u30c8\u306e<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Methods\" target=\"_blank\" rel=\"noopener noreferrer\">\u30e1\u30bd\u30c3\u30c9<\/a>\u3092<code>@app.get<\/code>\u3084<code>@app.post<\/code>\u306e\u3088\u3046\u306b\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001<code>GET<\/code>\u3001<code>POST<\/code>\u3001<code>PUT<\/code>\u3001<code>DELETE<\/code>\u3084\u3001\u3042\u307e\u308a\u4e00\u822c\u7684\u3067\u306f\u306a\u3044\u9078\u629e\u80a2\u3067\u3042\u308b<code>HEAD<\/code>\u3001<code>PATCH<\/code>\u3001<code>TRACE<\/code>\u3082\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>FastAPI\u3067\u30a2\u30d7\u30ea\u3092\u69cb\u7bc9\u3059\u308b<\/h2>\n<p>\u7d9a\u3044\u3066\u306f\u3001FastAPI\u3092\u4f7f\u7528\u3057\u3066<a href=\"https:\/\/www.codecademy.com\/article\/what-is-crud\" target=\"_blank\" rel=\"noopener noreferrer\">CRUD<\/a>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u4ee5\u4e0b\u306e\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3059\u308b<\/li>\n<li>\u30e6\u30fc\u30b6\u30fc\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ec\u30b3\u30fc\u30c9\u3092\u8aad\u307f\u8fbc\u3080<\/li>\n<li>\u65e2\u5b58\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u60c5\u5831\u3092\u5909\u66f4\u3059\u308b<\/li>\n<li>\u65e2\u5b58\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b<\/li>\n<\/ul>\n<p>CRUD\u306e\u5404\u64cd\u4f5c\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u3001API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u516c\u958b\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u305d\u306e\u7d50\u679c\u3068\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u30ea\u30b9\u30c8\u3092\u4fdd\u5b58\u3067\u304d\u308b\u30a4\u30f3\u30e1\u30e2\u30ea\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u51fa\u6765\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n<figure style=\"width: 864px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/database-table-fastapi-crud-example.png\" alt=\"CRUD\u306e\u4f8b\uff08\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u9020\uff09\" width=\"864\" height=\"551\"><figcaption class=\"wp-caption-text\">CRUD\u306e\u4f8b\uff08\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u9020\uff09<\/figcaption><\/figure>\n<p>Python\u306e\u578b\u6ce8\u91c8\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u306e\u691c\u8a3c\u3084\u8a2d\u5b9a\u7ba1\u7406\u3092\u884c\u3046\u305f\u3081\u306b\u3001<a href=\"https:\/\/pydantic-docs.helpmanual.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">pydantic<\/a>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u3001\u30c7\u30fc\u30bf\u306e\u5f62\u72b6\u3092\u5c5e\u6027\u3092\u6301\u3064\u30af\u30e9\u30b9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30e1\u30e2\u30ea\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u7528\u3057\u307e\u3057\u3087\u3046\u3002\u3053\u308c\u306b\u3088\u308a\u3001FastAPI\u3092\u4f7f\u3044\u306a\u304c\u3089API\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3068\u306f\u8a00\u3048\u3001\u5b9f\u969b\u306e\u958b\u767a\u74b0\u5883\u3067\u306f\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/what-is-postgresql\/\">PostgreSQL<\/a>\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/what-is-mysql\/\">MySQL<\/a>\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/sqlite-vs-mysql\/#what-is-sqlite\">SQLite<\/a>\u3001\u3042\u308b\u3044\u306fOracle\u306a\u3069\u3001\u597d\u307f\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u305f\u3060\u3044\u3066\u304b\u307e\u3044\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30a2\u30d7\u30ea\u306e\u69cb\u7bc9<\/h3>\n<p>\u307e\u305a\u3001\u30e6\u30fc\u30b6\u30fc\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30e6\u30fc\u30b6\u30fc\u30e2\u30c7\u30eb\u306b\u306f\u3001\u6b21\u306e\u3088\u3046\u306a\u5c5e\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>id<\/code>\uff1aUUID\uff08\u6c4e\u7528\u4e00\u610f\u8b58\u5225\u5b50\uff09<\/li>\n<li><code>first_name<\/code>\uff1a\u30e6\u30fc\u30b6\u30fc\u306e\u540d\u524d<\/li>\n<li><code>last_name<\/code>\uff1a\u30e6\u30fc\u30b6\u30fc\u306e\u82d7\u5b57<\/li>\n<li><code>gender<\/code>\uff1a\u30e6\u30fc\u30b6\u30fc\u306e\u6027\u5225<\/li>\n<li><code>roles<\/code>\uff1a<code>admin<\/code>\u3068<code>user<\/code>\u3068\u3044\u3046\u5f79\u5272\u304c\u3053\u308c\u306b\u542b\u307e\u308c\u308b<\/li>\n<\/ul>\n<p>\u307e\u305a\u3001\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b<strong>models.py<\/strong>\u3068\u3044\u3046\u540d\u524d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u3092<strong>models.py<\/strong>\u306b\u8cbc\u308a\u4ed8\u3051\u3066\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\">\n# models.py\nfrom typing import List, Optional\nfrom uuid import UUID, uuid4\nfrom pydantic import BaseModel\nfrom enum import Enum\nfrom pydantic import BaseModel\nclass Gender(str, Enum):\n male = \"male\"\n female = \"female\"\nclass Role(str, Enum):\n admin = \"admin\"\n user = \"user\"\nclass User(BaseModel):\n id: Optional[UUID] = uuid4()\n first_name: str\n last_name: str\n gender: Gender\n roles: List[Role]\n<\/code><\/pre>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u3092\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li><code>User<\/code>\u30af\u30e9\u30b9\u304c<code>BaseModel<\/code>\u3092\u7d99\u627f\u3057\u3001\u3053\u308c\u304c<code>pydantic<\/code>\u304b\u3089\u30a4\u30f3\u30dd\u30fc\u30c8\u3055\u308c\u308b<\/li>\n<li>\u4e0a\u8ff0\u306e\u3088\u3046\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u5c5e\u6027\u3092\u5b9a\u7fa9<\/li>\n<\/ul>\n<p>\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4f5c\u6210\u3067\u3059\u3002<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code class=\"language-python\">\n# main.py\nfrom typing import List\nfrom uuid import uuid4\nfrom fastapi import FastAPI\nfrom models import Gender, Role, User\napp = FastAPI()\ndb: List[User] = [\n User(\n id=uuid4(),\n first_name=\"John\",\n last_name=\"Doe\",\n gender=Gender.male,\n roles=[Role.user],\n ),\n User(\n id=uuid4(),\n first_name=\"Jane\",\n last_name=\"Doe\",\n gender=Gender.female,\n roles=[Role.user],\n ),\n User(\n id=uuid4(),\n first_name=\"James\",\n last_name=\"Gabriel\",\n gender=Gender.male,\n roles=[Role.user],\n ),\n User(\n id=uuid4(),\n first_name=\"Eunit\",\n last_name=\"Eunit\",\n gender=Gender.male,\n roles=[Role.admin, Role.user],\n ),\n]\n<\/code><\/pre>\n<p><strong>main.py<\/strong>\u3067\u4ee5\u4e0b\u306e\u64cd\u4f5c\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>db<\/code>\u3092<code>List<\/code>\u306e\u578b\u3067\u521d\u671f\u5316\u3057\u3001<code>User<\/code>\u306e\u30e2\u30c7\u30eb\u3092\u6e21\u3059<\/li>\n<li>\u305d\u308c\u305e\u308c<code>first_name<\/code>\u3001<code>last_name<\/code>\u3001<code>gender<\/code>\u3001<code>roles<\/code>\u306e\u3088\u3046\u306a\u5fc5\u8981\u3068\u3055\u308c\u308b\u5c5e\u6027\u3092\u6301\u30644\u4eba\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u683c\u7d0d\u3059\u308b\u30a4\u30f3\u30e1\u30e2\u30ea\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\uff08\u30e6\u30fc\u30b6\u30fc<code>Eunit<\/code>\u306b\u306f<code>admin<\/code>\u3068<code>user<\/code>\u306e\u5f79\u5272\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u3001\u4ed6\u306e3\u4eba\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u306f<code>user<\/code>\u306e\u307f\u5272\u308a\u5f53\u3066\u3089\u308c\u308b\uff09<\/li>\n<\/ul>\n<h3>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ec\u30b3\u30fc\u30c9\u306e\u8aad\u307f\u51fa\u3057<\/h3>\n<p>\u3053\u3053\u307e\u3067\u3067\u3001\u30a4\u30f3\u30e1\u30e2\u30ea\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3068\u30e6\u30fc\u30b6\u30fc\u306e\u767b\u9332\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u3067\u3001\u3059\u3079\u3066\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u4e00\u89a7\u3092\u8fd4\u3059\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002FastAPI\u306e\u8155\u306e\u898b\u305b\u3069\u3053\u308d\u3067\u3059\u3002<\/p>\n<p><strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u3067\u3001<code>Hello World<\/code>\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u3059\u3050\u4e0b\u306b\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\">\n# main.py\n @app.get(\"\/api\/v1\/users\")\n async def get_users():\n return db\n<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306b\u3088\u308a\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8<code>\/api\/v1\/users<\/code>\u304c\u5b9a\u7fa9\u3055\u308c\u3001\u307e\u305f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9<code>db<\/code>\u306e\u3059\u3079\u3066\u306e\u5185\u5bb9\u3092\u8fd4\u3059\u975e\u540c\u671f\u95a2\u6570<code>get_users<\/code>\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3059\u308b\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u30c6\u30b9\u30c8\u304c\u53ef\u80fd\u3067\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3001API\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><code class=\"language-bash\">$ uvicorn main:app --reload<\/code><\/pre>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u3001<code>http:\/\/localhost:8000\/api\/v1\/users<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u3059\u3079\u3066\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u4e00\u89a7\u304c\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<figure style=\"width: 685px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/fastapi-results-read-request.png\" alt=\"FastAPI\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8aad\u307f\u8fbc\u307f\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\" width=\"685\" height=\"1029\"><figcaption class=\"wp-caption-text\">FastAPI\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8aad\u307f\u8fbc\u307f\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3092\u53d6\u5f97<\/figcaption><\/figure>\n<p>\u3053\u306e\u6bb5\u968e\u3067\u3001<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\">\n# main.py\nfrom typing import List\nfrom uuid import uuid4\nfrom fastapi import FastAPI\nfrom models import Gender, Role, User\napp = FastAPI()\ndb: List[User] = [\n User(\n id=uuid4(),\n first_name=\"John\",\n last_name=\"Doe\",\n gender=Gender.male,\n roles=[Role.user],\n ),\n User(\n id=uuid4(),\n first_name=\"Jane\",\n last_name=\"Doe\",\n gender=Gender.female,\n roles=[Role.user],\n ),\n User(\n id=uuid4(),\n first_name=\"James\",\n last_name=\"Gabriel\",\n gender=Gender.male,\n roles=[Role.user],\n ),\n User(\n id=uuid4(),\n first_name=\"Eunit\",\n last_name=\"Eunit\",\n gender=Gender.male,\n roles=[Role.admin, Role.user],\n ),\n]\n@app.get(\"\/\")\nasync def root():\n return {\"Hello\": \"World\",}\n@app.get(\"\/api\/v1\/users\")\nasync def get_users():\n return db\n<\/code><\/pre>\n<h3>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210<\/h3>\n<p>\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u306e\u65b0\u898f\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u306e\u305f\u3081\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u4f5c\u6210\u3067\u3059\u3002\u6b21\u306e\u30b3\u30fc\u30c9\u3092<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b\u8cbc\u308a\u4ed8\u3051\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code class=\"language-python\">\n# main.py\n@app.post(\"\/api\/v1\/users\")\nasync def create_user(user: User):\n db.append(user)\n return {\"id\": user.id}\n<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u65b0\u898f\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u7528\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u5b9a\u7fa9\u3057\u3001<code>@app.post<\/code>\u30c7\u30b3\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057<code>POST<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001<code>User<\/code>\u30e2\u30c7\u30eb\u306e<code>user<\/code>\u3092\u53d7\u3051\u53d6\u308b\u95a2\u6570<code>create_user<\/code>\u3092\u4f5c\u6210\u3057\u3001\u65b0\u898f\u4f5c\u6210\u3057\u305f<code>user<\/code>\u3092\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9<code>db<\/code>\u306b\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001\u3053\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u304b\u3089\u306f\u3001\u4f5c\u6210\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306e<code>id<\/code>\u306eJSON\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u4e0a\u8ff0\u306e\u3088\u3046\u306b\u3001\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u30c6\u30b9\u30c8\u3059\u308b\u306b\u306f\u3001FastAPI\u306e\u81ea\u52d5API\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3092\u4f7f\u7528\u3057POST\u3092\u5b9f\u884c\u3067\u304d\u306a\u3044\u305f\u3081\u3067\u3059\u3002<code>http:\/\/localhost:8000\/docs<\/code>\u306b\u79fb\u52d5\u3059\u308b\u3053\u3068\u3067\u3001<a href=\"https:\/\/github.com\/swagger-api\/swagger-ui\">Swagger<\/a>\u3092\u5229\u7528\u3057\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<figure style=\"width: 685px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/fastapi-parameters-post-request.png\" alt=\"FastAPI\u306ePOST\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b\" width=\"685\" height=\"1029\"><figcaption class=\"wp-caption-text\">FastAPI\u306ePOST\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b<\/figcaption><\/figure>\n<h3>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ec\u30b3\u30fc\u30c9\u306e\u524a\u9664<\/h3>\n<p>\u4eca\u56de\u306e\u4f8b\u3067\u306f\u3001CRUD\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u69cb\u7bc9\u3092\u884c\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u306f\u6307\u5b9a\u3057\u305f\u30ea\u30bd\u30fc\u30b9\u3092<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Methods\/DELETE\">\u524a\u9664<\/a>\u3059\u308b\u6a5f\u80fd\u304c\u5fc5\u8981\u3067\u3059\u3002\u305d\u308c\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u524a\u9664\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\">\n# main.py\nfrom uuid import UUID\nfrom fastapi HTTPException\n@app.delete(\"\/api\/v1\/users\/{id}\")\nasync def delete_user(id: UUID):\nfor user in db:\n if user.id == id:\n db.remove(user)\n return\nraise HTTPException(\n status_code=404, detail=f\"Delete user failed, id {id} not found.\"\n )\n<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u884c\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li><code>@app.delete(\"\/api\/v1\/users\/{id}\")<\/code>\uff1a<code>@app.delete()<\/code>\u30c7\u30b3\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066delete\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f5c\u6210\uff08\u30d1\u30b9\u306f<code>\/api\/v1\/users\/{id}<\/code>\u306e\u307e\u307e\u3067\u3059\u304c\u3001\u305d\u306e\u5f8c\u3001\u30e6\u30fc\u30b6\u30fc\u306eid\u306b\u5bfe\u5fdc\u3059\u308b\u30d1\u30b9\u5909\u6570\u3067\u3042\u308b<code>id<\/code>\u3092\u53d6\u5f97\uff09<\/li>\n<li><code>async def delete_user(id: UUID)<\/code>\uff1aURL\u304b\u3089<code>id<\/code>\u3092\u53d6\u5f97\u3059\u308b<code>delete_user<\/code>\u95a2\u6570\u3092\u4f5c\u6210<\/li>\n<li><code>for user in db:<\/code>\uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5185\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u30eb\u30fc\u30d7\u3057\u3001\u6e21\u3055\u308c\u305f<code>id<\/code>\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5185\u306e\u30e6\u30fc\u30b6\u30fc\u3068\u4e00\u81f4\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af<\/li>\n<li><code>db.remove(user)<\/code>\uff1a<code>id<\/code>\u304c\u30e6\u30fc\u30b6\u30fc\u3068\u4e00\u81f4\u3057\u305f\u5834\u5408\u3001\u305d\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u524a\u9664\u3059\u308b\uff08\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/http-status-codes\/\">\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9<\/a>404\u306e<code>HTTPException<\/code>\u304c\u767a\u751f\uff09<\/li>\n<\/ul>\n<figure style=\"width: 594px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/fastapi-parameters-delete-request.png\" alt=\"FastAPI\u306eDELETE\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b\" width=\"594\" height=\"1030\"><figcaption class=\"wp-caption-text\">FastAPI\u306eDELETE\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b<\/figcaption><\/figure>\n<h3>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ec\u30b3\u30fc\u30c9\u306e\u66f4\u65b0<\/h3>\n<p>\u7d9a\u3044\u3066\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u60c5\u5831\u3092\u66f4\u65b0\u3059\u308b\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u66f4\u65b0\u5bfe\u8c61\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f<code>first_name<\/code>\u3001<code>last_name<\/code>\u3001<code>roles<\/code>\u3067\u3059\u3002<\/p>\n<p><strong>models.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u3067\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u3092<code>User<\/code>\u30e2\u30c7\u30eb\u306e\u4e0b\u306b\u3001\u3064\u307e\u308a<code>User(BaseModel):<\/code>\u30af\u30e9\u30b9\u306e\u5f8c\u306b\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\"> # models.py\n class UpdateUser(BaseModel):\n first_name: Optional[str]\n last_name: Optional[str]\n roles: Optional[List[Role]]\n<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u3001\u30af\u30e9\u30b9<code>UpdateUser<\/code>\u306f<code>BaseModel<\/code>\u3092\u7d99\u627f\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u3057\u3066\u3001<code>first_name<\/code>\u3001<code>last_name<\/code>\u3001<code>roles<\/code>\u306e\u3088\u3046\u306a\u7de8\u96c6\u5bfe\u8c61\u3068\u306a\u308b\u30e6\u30fc\u30b6\u30fc\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001\u7279\u5b9a\u306e\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u306e\u66f4\u65b0\u306b\u4f7f\u7528\u3059\u308b\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u5185\u3001<code>@app.delete<\/code>\u30c7\u30b3\u30ec\u30fc\u30bf\u306e\u5f8c\u306b\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\"># main.py\n@app.put(\"\/api\/v1\/users\/{id}\")\nasync def update_user(user_update: UpdateUser, id: UUID):\n for user in db:\n if user.id == id:\n if user_update.first_name is not None:\n user.first_name = user_update.first_name\n if user_update.last_name is not None:\n user.last_name = user_update.last_name\n if user_update.roles is not None:\n user.roles = user_update.roles\n return user.id\n raise HTTPException(status_code=404, detail=f\"{id}\u306b\u8a72\u5f53\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\")\n<\/code><\/pre>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u3053\u3068\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u60c5\u5831\u7de8\u96c6\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3067\u3042\u308b<code>@app.put(\"\/api\/v1\/users\/{id}\")<\/code>\u3092\u4f5c\u6210\uff08\u30e6\u30fc\u30b6\u30fc\u306eID\u306b\u5bfe\u5fdc\u3059\u308b\u5909\u6570\u30d1\u30e9\u30e1\u30fc\u30bf<code>id<\/code>\u3042\u308a\uff09<\/li>\n<li><code>update_user<\/code>\u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u6210\uff08<code>UpdateUser<\/code>\u30af\u30e9\u30b9\u3068<code>id<\/code>\u3092\u53d6\u5f97\uff09<\/li>\n<li><code>for<\/code>\u30eb\u30fc\u30d7\u3092\u4f7f\u7528\u3057\u3066\u3001\u6e21\u3055\u308c\u305f<code>id<\/code>\u306b\u7d10\u4ed8\u3051\u3089\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af<\/li>\n<li>\u30e6\u30fc\u30b6\u30fc\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u3044\u305a\u308c\u304b\u304c<code>is not None<\/code>\uff08null\u3067\u306a\u3044\uff09 \u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\uff08<code>first_name<\/code>\u3001<code>last_name<\/code>\u3001<code>roles<\/code>\u306a\u3069\u3001\u3044\u305a\u308c\u304b\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304cnull\u3067\u306a\u3044\u5834\u5408\u305d\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5909\u66f4\u3055\u308c\u308b\uff09<\/li>\n<li>\u64cd\u4f5c\u306b\u6210\u529f\u3059\u308b\u3068\u3001\u30e6\u30fc\u30b6\u30fcID\u304c\u8fd4\u3055\u308c\u308b<\/li>\n<li>\u30e6\u30fc\u30b6\u30fc\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u3001\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9404\uff08\u305d\u3057\u3066\u30e1\u30c3\u30bb\u30fc\u30b8<code>{id}\u306b\u8a72\u5f53\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f<\/code>\uff09\u306e<code>HTTPException<\/code>\u304c\u8868\u793a\u3055\u308c\u308b<\/li>\n<\/ul>\n<p>\u3053\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u30c6\u30b9\u30c8\u306e\u969b\u306b\u306f\u3001Uvicorn\u30b5\u30fc\u30d0\u30fc\u304c\u7a3c\u50cd\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306b\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code class=\"language-bash\">uvicorn main:app --reload<\/code><\/pre>\n<p>\u30c6\u30b9\u30c8\u7d50\u679c\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u304c\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<figure style=\"width: 593px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/wp-content\/uploads\/2022\/11\/fastapi-parameters-update-request.png\" alt=\"FastAPI\u306eUPDATE\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b\" width=\"593\" height=\"954\"><figcaption class=\"wp-caption-text\">FastAPI\u306eUPDATE\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b<\/figcaption><\/figure>\n\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001Python\u306eFastAPI\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u57fa\u790e\u3001\u305d\u3057\u3066\u3001FastAPI \u3092\u4f7f\u7528\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7d20\u65e9\u3044\u7acb\u3061\u4e0a\u3052\u306e\u4f8b\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u5177\u4f53\u7684\u306b\u306f\u3001\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u7528\u3057\u305f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210\u3001\u8aad\u307f\u51fa\u3057\u3001\u66f4\u65b0\u3001\u524a\u9664\u3068\u3044\u3063\u305fCRUD API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u69cb\u7bc9\u3092\u6271\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u958b\u767a\u3092\u6b21\u306e\u30ec\u30d9\u30eb\u306b\u5f15\u304d\u4e0a\u3052\u308b\u306b\u306f\u3001<a href=\"https:\/\/kinsta.com\/jp\/changelog\/application-database-hosting\/\">\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3068\u30de\u30cd\u30fc\u30b8\u30c9\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc<\/a>\u3092\u306f\u3058\u3081\u3068\u3059\u308b\u3001Kinsta\u306e\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3092\u3054\u6d3b\u7528\u304f\u3060\u3055\u3044\u3002FastAPI\u3068\u540c\u69d8\u306b\u3001\u30b7\u30f3\u30d7\u30eb\u304b\u3064\u9ad8\u6027\u80fd\u3067\u3059\u3002<\/p>\n<kinsta-video src=\"https:\/\/www.youtube.com\/watch?v=vmNem6wxfSQ\"><\/kinsta-video>\n","protected":false},"excerpt":{"rendered":"<p>FastAPI \u306f\u3001Python 3.6\u4ee5\u964d\u3092\u4f7f\u7528\u3057 &#8230;<\/p>\n","protected":false},"author":270,"featured_media":39512,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kinsta_gated_content":false,"_kinsta_gated_content_redirect":"","footnotes":""},"tags":[555,628,603,184],"topic":[751,801],"class_list":["post-39511","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-api","tag-python","tag-web-applications","tag-web-development","topic-api","topic-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.6 (Yoast SEO v24.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b \uff5cKinsta\u00ae<\/title>\n<meta name=\"description\" content=\"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b\" \/>\n<meta property=\"og:description\" content=\"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/\" \/>\n<meta property=\"og:site_name\" content=\"Kinsta\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-29T12:09:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-25T15:15:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1460\" \/>\n\t<meta property=\"og:image:height\" content=\"730\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Emmanuel Uchenna\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@Kinsta_JP\" \/>\n<meta name=\"twitter:site\" content=\"@Kinsta_JP\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Emmanuel Uchenna\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"6\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/\"},\"author\":{\"name\":\"Emmanuel Uchenna\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/8deb20857e9f90e6cc3c2426da8f343f\"},\"headline\":\"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b\",\"datePublished\":\"2022-11-29T12:09:11+00:00\",\"dateModified\":\"2023-08-25T15:15:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/\"},\"wordCount\":248,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg\",\"keywords\":[\"API\",\"Python\",\"web applications\",\"web development\"],\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/\",\"url\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/\",\"name\":\"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b \uff5cKinsta\u00ae\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg\",\"datePublished\":\"2022-11-29T12:09:11+00:00\",\"dateModified\":\"2023-08-25T15:15:26+00:00\",\"description\":\"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage\",\"url\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg\",\"contentUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg\",\"width\":1460,\"height\":730},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kinsta.com\/jp\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"API\",\"item\":\"https:\/\/kinsta.com\/jp\/topics\/api\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kinsta.com\/jp\/#website\",\"url\":\"https:\/\/kinsta.com\/jp\/\",\"name\":\"Kinsta\u00ae\",\"description\":\"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9\",\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kinsta.com\/jp\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\",\"name\":\"Kinsta\",\"url\":\"https:\/\/kinsta.com\/jp\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"contentUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"width\":500,\"height\":500,\"caption\":\"Kinsta\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\",\"https:\/\/x.com\/Kinsta_JP\",\"https:\/\/www.instagram.com\/kinstahosting\/\",\"https:\/\/www.linkedin.com\/company\/kinsta\/\",\"https:\/\/www.pinterest.com\/kinstahosting\/\",\"https:\/\/www.youtube.com\/c\/Kinsta\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/8deb20857e9f90e6cc3c2426da8f343f\",\"name\":\"Emmanuel Uchenna\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ad8b6a83415f2708e437768feb16d3da?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ad8b6a83415f2708e437768feb16d3da?s=96&d=mm&r=g\",\"caption\":\"Emmanuel Uchenna\"},\"description\":\"Emmanuel is an experienced, passionate, and enthusiastic software developer and technical writer with proven years of professional experience. He focuses on full-stack web development. He's fluent in ReactJS, JavaScript, VueJS, and NodeJS and familiar with industry-standard technologies such as Git, GitHub, and TDD. He helps individuals, businesses, and brands build responsive, accessible, beautiful, and intuitive websites to improve their online presence. He is also a technical writer for various websites and his own projects.\",\"url\":\"https:\/\/kinsta.com\/jp\/blog\/author\/emmanueluchenna\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b \uff5cKinsta\u00ae","description":"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/","og_locale":"ja_JP","og_type":"article","og_title":"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b","og_description":"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","og_url":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/","og_site_name":"Kinsta\u00ae","article_publisher":"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","article_published_time":"2022-11-29T12:09:11+00:00","article_modified_time":"2023-08-25T15:15:26+00:00","og_image":[{"width":1460,"height":730,"url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg","type":"image\/jpeg"}],"author":"Emmanuel Uchenna","twitter_card":"summary_large_image","twitter_description":"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","twitter_image":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg","twitter_creator":"@Kinsta_JP","twitter_site":"@Kinsta_JP","twitter_misc":{"\u57f7\u7b46\u8005":"Emmanuel Uchenna","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"6\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#article","isPartOf":{"@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/"},"author":{"name":"Emmanuel Uchenna","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/8deb20857e9f90e6cc3c2426da8f343f"},"headline":"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b","datePublished":"2022-11-29T12:09:11+00:00","dateModified":"2023-08-25T15:15:26+00:00","mainEntityOfPage":{"@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/"},"wordCount":248,"commentCount":0,"publisher":{"@id":"https:\/\/kinsta.com\/jp\/#organization"},"image":{"@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg","keywords":["API","Python","web applications","web development"],"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kinsta.com\/jp\/blog\/fastapi\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/","url":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/","name":"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b \uff5cKinsta\u00ae","isPartOf":{"@id":"https:\/\/kinsta.com\/jp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage"},"image":{"@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg","datePublished":"2022-11-29T12:09:11+00:00","dateModified":"2023-08-25T15:15:26+00:00","description":"\u3053\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u300cFast\u300d\u3068\u547c\u3070\u308c\u308b\u306e\u306b\u306f\u3001\u308c\u3063\u304d\u3068\u3057\u305f\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002Python\u3092\u4f7f\u3063\u305f\u9ad8\u901f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u69cb\u7bc9\u3092\u652f\u63f4\u3059\u308bFastAPI\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kinsta.com\/jp\/blog\/fastapi\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#primaryimage","url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg","contentUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2022\/11\/fastapi.jpg","width":1460,"height":730},{"@type":"BreadcrumbList","@id":"https:\/\/kinsta.com\/jp\/blog\/fastapi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kinsta.com\/jp\/"},{"@type":"ListItem","position":2,"name":"API","item":"https:\/\/kinsta.com\/jp\/topics\/api\/"},{"@type":"ListItem","position":3,"name":"FastAPI\u3067Python\u30a2\u30d7\u30ea\u3092\u7d20\u65e9\u304f\u69cb\u7bc9\u3059\u308b"}]},{"@type":"WebSite","@id":"https:\/\/kinsta.com\/jp\/#website","url":"https:\/\/kinsta.com\/jp\/","name":"Kinsta\u00ae","description":"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9","publisher":{"@id":"https:\/\/kinsta.com\/jp\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kinsta.com\/jp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/kinsta.com\/jp\/#organization","name":"Kinsta","url":"https:\/\/kinsta.com\/jp\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/","url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","contentUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","width":500,"height":500,"caption":"Kinsta"},"image":{"@id":"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","https:\/\/x.com\/Kinsta_JP","https:\/\/www.instagram.com\/kinstahosting\/","https:\/\/www.linkedin.com\/company\/kinsta\/","https:\/\/www.pinterest.com\/kinstahosting\/","https:\/\/www.youtube.com\/c\/Kinsta"]},{"@type":"Person","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/8deb20857e9f90e6cc3c2426da8f343f","name":"Emmanuel Uchenna","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ad8b6a83415f2708e437768feb16d3da?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ad8b6a83415f2708e437768feb16d3da?s=96&d=mm&r=g","caption":"Emmanuel Uchenna"},"description":"Emmanuel is an experienced, passionate, and enthusiastic software developer and technical writer with proven years of professional experience. He focuses on full-stack web development. He's fluent in ReactJS, JavaScript, VueJS, and NodeJS and familiar with industry-standard technologies such as Git, GitHub, and TDD. He helps individuals, businesses, and brands build responsive, accessible, beautiful, and intuitive websites to improve their online presence. He is also a technical writer for various websites and his own projects.","url":"https:\/\/kinsta.com\/jp\/blog\/author\/emmanueluchenna\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/39511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/users\/270"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/comments?post=39511"}],"version-history":[{"count":9,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/39511\/revisions"}],"predecessor-version":[{"id":46420,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/39511\/revisions\/46420"}],"alternate":[{"embeddable":true,"hreflang":"en","title":"English","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/en"},{"embeddable":true,"hreflang":"it","title":"Italian","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/it"},{"embeddable":true,"hreflang":"pt","title":"Portuguese","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/pt"},{"embeddable":true,"hreflang":"fr","title":"French","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/fr"},{"embeddable":true,"hreflang":"de","title":"German","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/de"},{"embeddable":true,"hreflang":"ja","title":"Japanese","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/jp"},{"embeddable":true,"hreflang":"nl","title":"Dutch","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/nl"},{"embeddable":true,"hreflang":"es","title":"Spanish","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/es"},{"embeddable":true,"hreflang":"sv","title":"Swedish","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/se"},{"embeddable":true,"hreflang":"da","title":"Danish","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/translations\/dk"},{"href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/39511\/tree"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/media\/39512"}],"wp:attachment":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/media?parent=39511"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/tags?post=39511"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/topic?post=39511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}