Code Monkey home page Code Monkey logo

fastapies's Introduction

FastAPI Easy Snippets

FastAPI Easy Snippets is a Visual Studio Code extension that provides code snippets for FastAPI to make life easier. Inspired by fastapi-snippets.

Features

Snippets

fes... - Easy access to FES (FastAPI Easy Snippets).

Abbreviation Description
fesinit FastAPI Init
fesaget async GET path
fesapost async POST path
fesaput async PUT path
fesadel async DELETE path
fesget GET path
fespost POST path
fesput PUT path
fesdel DELETE path
fesadef async function
fesbasemodel Pydantic BaseModel
feserror Custom Error Handling
fessqldb SQLAlchemy Database
fesgetdb SessionLocal Dependency
fesstup Startup Event
fesshdn Shutdown Event

Usage

Initiate FastAPI app (fes + init):

# fesinit :
from fastapi import FastAPI
app = FastAPI()

@app.get("/")
async def index():
    return {"message": "Hello FES APP"}

async [METHOD] path (fes + a + [method]):

methods: GET, POST, PUT, DEL

# fesaget :
@app.get('/path_name')
async def method_name(args):
    pass

sync [METHOD] path (fes + [method]):

methods: GET, POST, PUT, DEL

# fesget :
@app.get('/path_name')
def method_name(args):
    pass

Pydantic BaseModel (fes + basemodel):

# fesbasemodel :
class ModelName(BaseModel):
    field_name: str

Custom Error Handling (fes + error):

# feserror :
class CustomException(Exception):
    def __init__(self):
        pass

@app.exception_handler(CustomException)
async def custom_exception_handler(request: Request, exc: CustomException):
    return JSONResponse(
        status_code=status_code,
        content={'message': 'message'}
    )

...

Contributing

Feel free to submit a pull request on github

Release Notes

See changelog for releases

For more information

Enjoy!

fastapies's People

Contributors

shekhrozx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.