Automatically translated.View original post

What is the Fast API?..???

# Web Site Writing Basics # Pythonprogramming # FastAPI # Trending # Drug sign with lemon8

FastAPI is the Web Framework, a new era of Python language that is becoming very popular, designed to be high performance and code fast to code, as its name suggests. If Flask is "good chef," FastAPI is like "chef using high-tech kitchen technology." 1.What is FastAPI? It is a tool to create an API (Application Programming Interface) that focuses mainly on speed, using modern Python features like Type Hints (Data Type Identification) to help code work accurately and almost without buck. 2. Highlights that make FastAPI more special than anyone. Gods speed: FastAPI is listed among Python's fastest Framework (as NodeJS or Go) because it runs on Asynchronous (async / await), reducing bugs: The system automatically checks data, such as if you order to receive a number, but the user sends the letter. FastAPI will notify you immediately without having to write the check code. Auto Docs: As soon as you write the code, FastAPI will create a Swagger UI web page for you to try and see how to use the API as soon as the link / docs support the new standard: Support JSON Schema and Integrated Safety System (OAuth2) 3. What can FastAPI do? With its speed and good data management, it is used in these tasks: Create a backend for the modern web: Use it with a home page made with React, Vue or Mobile App (as you are doing Peemai Shop) Data Science & AI System: Researchers use FastAPI to release (Deploy) Machine Learning models for others to run because it transmits big data quickly Microservices: Use to create subsystems that need to talk to each other within an organization at high speed IoT (Internet of Things): Use it as a receiver from a large number of sensors at the same time 4. Compare to Flask (which you used to use). FlaskFastAPI topic is very independent writing style. Simple to specify data type (Type Hints), medium speed (work one task at a time), very fast (work multiple tasks at the same time). Checking must code the check itself, automatic check the document. API must install more Library. Available in a short summary. If you want to make a website that focuses on speed, supports many visitors, or often sends data to other systems, FastAPI is the best answer right now. But if you just want to make a small web page, display products without complexity, Flask is also a "easy and easy" choice.

5/1 Edited to

... Read moreจากประสบการณ์ใช้งาน FastAPI มาในโปรเจกต์จริง ต้องบอกว่า Framework นี้ช่วยให้การพัฒนา API รวดเร็วและมีประสิทธิภาพมากขึ้นจริง ๆ เพราะการรองรับ async/await ทำให้จัดการคำร้องขอเรียก API หลาย ๆ จุดพร้อมกันได้ดีมาก ในเทียบกับ Flask ที่เคยใช้มาก่อน FastAPI ช่วยลดเวลาเขียนโค้ดเช็คความถูกต้องของข้อมูลด้วยระบบตรวจสอบตัวแปรอัตโนมัติ ทำให้โค้ดผิดพลาดน้อยลงและดูแลง่ายขึ้น สำหรับคนที่เคยเขียน API บน Flask แล้วเคยเจอปัญหาการจัดการข้อมูลและต้องทำเอกสารเอง FastAPI มาพร้อมกับ Swagger UI ที่แสดง API Document แบบ interactive ช่วยให้ทีมงานและคนใช้งานง่ายขึ้นเยอะ นอกจากนี้ FastAPI ยังตอบโจทย์งานที่ต้องรับส่งข้อมูลขนาดใหญ่ เช่น โมเดล Machine Learning ในระบบ AI ที่ผมเคยทำ Prototype ส่งข้อมูลและผลการประมวลผลแบบเรียลไทม์ ผ่าน API ได้อย่างรวดเร็วและเสถียร จุดเด่นที่ผมประทับใจที่สุดคือความง่ายในการใช้ Type Hints ของ Python มาเพิ่มความชัดเจนในโค้ด ช่วยลดข้อผิดพลาดและเพิ่มความแม่นยำ ทำให้โค้ดที่เขียนมีคุณภาพมากขึ้น เหมาะมากกับงานระดับโปรดักชันที่ต้องรองรับผู้ใช้งานจำนวนมาก ถ้ายังไม่เคยลองใช้ FastAPI ผมแนะนำให้ลองสร้างโปรเจกต์เล็ก ๆ ดูก่อน จะรู้สึกทันทีว่าเขียนง่ายและเร็วกว่า Framework เดิมหลายเท่า