header
{
"HEADER":{"prefix": "header",
"body": [
"#!/usr/bin/env python",
"# -*- coding: utf-8 -*-",
"'''",
"@File : $TM_FILENAME",
"@Time : $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
"@Author : Chen GangQiang ",
"@Version : 1.0",
"@Desc : None",
"'''",
"",
"$0"
],
}
}
fastapi
{
"fastapi开发模板": {
"prefix": "fastapi",
"body": [
"from fastapi import FastAPI, Response",
"",
"",
"# 创建FastAPI应用",
"app = FastAPI()",
"",
"",
"@app.get(\"/\")",
"def read_root() -> Response:",
" return Response(\"The server is running!\")",
"",
"",
"@app.get(\"/items/{item_id}\")",
"async def read_item(item_id: int):",
" return {\"item_id\": item_id, \"name\": \"The Name of the Item\", \"description\": \"A description of the item\"}",
"",
"",
"if __name__ == '__main__':",
" import uvicorn",
" import os",
"",
" # 获取当前文件的文件名,不包含后缀",
" file_name = os.path.splitext(os.path.basename(__file__))[0]",
"",
" # 运行FastAPI应用",
" uvicorn.run(f\"{file_name}:app\", host=\"127.0.0.1\", port=8000, reload=True)"
],
"description": "fastapi开发模板"
}
}