Build a FastAPI MongoDB Rest API ⚡ for Blogging Site

preview_player
Показать описание


Learn how to create a blazing-fast blogging site using FastAPI and MongoDB with PyMongo as the backend. Follow along with FunTechs as we delve into the world of Python web development, exploring the power of FastAPI for building efficient RESTful APIs and integrating MongoDB for seamless data management.

Whether you're a beginner or an experienced developer, this step-by-step tutorial will guide you through setting up a robust backend for your blogging platform. Don't miss out on this opportunity to enhance your skills and level up your web development game with FunTechs!

🔔 Don't forget to hit the subscribe button and ring the notification bell so you never miss an update! Join our community of tech enthusiasts, marketers, and creative minds.

#SubscribeNow #TechEnthusiasts #MarketingInsights #CreateWithUs #JoinTheCommunity
Рекомендации по теме
Комментарии
Автор

🎯 Key points for quick navigation:

00:02 *📝 Building a blogging backend system to create, retrieve, update, and delete blogs.*
00:30 *📡 An API allows software applications to communicate, defining methods and data formats for information exchange.*
00:58 *🔍 GET request retrieves all blogs from the server.*
01:11 *📝 POST request creates and saves a new blog on the server.*
01:26 *🔄 PATCH request updates an existing blog in the database.*
01:39 *🗑️ DELETE request removes a blog from the database.*
01:55 *🛠️ Setting up the environment and performing CRUD operations with FastAPI and MongoDB.*
02:25 *📁 Creating a project directory named "python_blog_backend".*
03:02 *🛠️ Installing virtual environment using pip.*
03:45 *✅ Virtual environment created and ready for activation.*
05:04 *🔌 Activating the virtual environment.*
05:30 *📦 Installing FastAPI and Uvicorn.*
06:04 *🗂️ Creating folder structure for config, routes, models, and serializers.*
07:09 *🛠️ Setting up the MongoDB configuration file to connect to the database.*
09:05 *🌐 Creating a MongoDB cluster and user account.*
11:14 *🔑 Adding IP address for MongoDB access.*
12:22 *🐍 Checking Python version to ensure compatibility.*
13:28 *🔗 Connecting to MongoDB using the connection URI.*
14:26 *📋 Creating database and collection for the blogging application.*
16:19 *🚀 Running the server and opening the project in VS Code.*
19:06 *📝 Creating the main entry point for the application.*
22:35 *🔄 Including the router in the main application file.*
24:10 *🔧 Creating a GET request to test the FastAPI setup.*
25:02 *🛠️ Creating models for blog posts using Pydantic.*
27:17 *📄 Creating a route file for handling blog-related endpoints.*
28:10 *📩 Creating a POST request to add new blog data to the database.*
29:00 *🛠️ Setting the route for posting new blogs using `"/new/blog"` as the endpoint.*
30:08 *📥 Using Pydantic's `BlockModel` to validate and enforce the data structure for new blog entries.*
31:41 *📝 Converting the incoming blog data to a Python dictionary for processing.*
32:23 *🔄 Including the new POST route in the FastAPI application.*
34:09 *📅 Automatically adding the current date to new blog entries.*
35:01 *🗂️ Using MongoDB’s `insert_one` method to add new blog data to the database.*
36:29 *🆔 Retrieving and returning the automatically generated MongoDB ID for the new blog entry.*
38:19 *🛠️ Checking the new entry in MongoDB and verifying the data structure.*
42:06 *🏷️ Posting additional blog entries with meaningful titles and tags for testing.*
43:10 *🗃️ Creating serializers to decode the blog data before displaying it.*
45:58 *🧩 Serializing all blog entries to a Python list for easy retrieval.*
47:04 *🌐 Setting up a GET request route to retrieve all blog entries.*
49:46 *🛠️ Decoding and returning the serialized blog data in response to GET requests.*
51:06 *🔍 Creating a GET request route to retrieve a single blog entry by ID.*
54:08 *🔗 Verifying retrieval of a single blog entry by ID from MongoDB.*
55:54 *🌐 Testing the GET request with specific blog IDs through the API.*
56:34 *🔄 Introducing a PATCH request route to update existing blog entries.*
57:00 *🛠️ Setting up the PATCH request route to update a blog by its ID.*
58:09 *📝 Ensuring that only the provided attributes are updated while keeping others unchanged.*
59:18 *🔧 Creating a separate model for updating blogs to allow partial updates.*
01:01:00 *🗂️ Assigning `None` to attributes in the update model to make them optional.*
01:02:06 *🔄 Dumping attributes with `None` values to only include those with data.*
01:04:26 *⚙️ Using `find_one_and_update` to locate and update the specific blog entry in the database.*
01:06:08 *✅ Verifying the blog update by checking the updated data.*
01:07:18 *🗑️ Setting up the DELETE request route to remove a blog by its ID.*
01:09:03 *🚮 Using `find_one_and_delete` to find and delete the specific blog entry in the database.*
01:09:59 *🔍 Verifying the blog deletion by checking the removal of the specified entry.*

Made with HARPA AI

venkat.sairam
Автор

can you please create videos for jwt authencation in fastapi using mongodb

harshalmahajan
Автор

Thanks man, it was really helpful, especially patch method!🙌👍

shohratdurdyyev
Автор

I would love to see tutorial like this. Thank you

But is that only way to update blog

m_muhd
Автор

bro can you do Oauth with jwt token authorisaton please!!

RamKiranYaram
visit shbcf.ru