sergk / fastapi Goto Github PK
View Code? Open in Web Editor NEWFastapi baseline
License: Apache License 2.0
Fastapi baseline
License: Apache License 2.0
As a user of the FastAPI application, I would like to have the ability to trigger background tasks via a new API endpoint /process
. This endpoint should execute a simple background task, such as running a command to sleep for a specified duration, and return the ID of the started task. Additionally, users should be able to check the status of background tasks using a polling approach by implementing a new endpoint /getresult
which retrieves the task status by ID.
/process
to trigger background tasks./process
endpoint should initiate a background task.sleep 15
./getresult
to retrieve the status of a background task by its ID./getresult
endpoint to check the status of a background task./process
endpoint successfully triggers a background task and returns the ID of the started task.sleep 15
./getresult
endpoint retrieves the status of a background task by its ID.Medium
Add the necessary code and functionality to implement CRUD (Create, Read, Update, Delete) API endpoints for managing a user database in the FastAPI application. The user database will be an in-memory database that stores users' data: username, email, and number of tasks. Additional checks and validations should be implemented as specified below.
Users should be represented using a Python class or data model that includes the following fields:
The API should support the following endpoints:
The API endpoints should interact with an in-memory database that holds the list of users.
Proper error handling should be implemented for cases such as invalid user IDs, non-existent users, incorrect email formats, or negative numbers of tasks.
The code should be well-structured, readable, and follow best practices for FastAPI development.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.