mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
feat: Front-end and back-end integration
This commit is contained in:
@@ -3,6 +3,7 @@ import re
|
||||
from typing import List, Pattern
|
||||
from common.core.config import settings
|
||||
wlist = [
|
||||
"/",
|
||||
"/docs",
|
||||
"/login/*",
|
||||
"*.json",
|
||||
|
||||
+9
-3
@@ -1,6 +1,7 @@
|
||||
from fastapi.responses import FileResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
import sentry_sdk
|
||||
from fastapi import FastAPI
|
||||
from fastapi import FastAPI, Path
|
||||
from fastapi.routing import APIRoute
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
from apps.api import api_router
|
||||
@@ -8,7 +9,8 @@ from apps.system.middleware.auth import TokenMiddleware
|
||||
from common.core.config import settings
|
||||
|
||||
def custom_generate_unique_id(route: APIRoute) -> str:
|
||||
return f"{route.tags[0]}-{route.name}"
|
||||
tag = route.tags[0] if route.tags and len(route.tags) > 0 else ""
|
||||
return f"{tag}-{route.name}"
|
||||
|
||||
|
||||
if settings.SENTRY_DSN and settings.ENVIRONMENT != "local":
|
||||
@@ -32,7 +34,11 @@ if settings.all_cors_origins:
|
||||
|
||||
app.add_middleware(TokenMiddleware)
|
||||
app.include_router(api_router, prefix=settings.API_V1_STR)
|
||||
app.mount("/", StaticFiles(directory='../frontend/dist'), name="static")
|
||||
app.mount("/static", StaticFiles(directory='../frontend/dist'), name="static")
|
||||
|
||||
@app.get("/", include_in_schema=False)
|
||||
async def read_index():
|
||||
return FileResponse(path="../frontend/dist/index.html")
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
|
||||
import Layout from '@/components/layout/index.vue'
|
||||
import login from '@/views/login/index.vue'
|
||||
@@ -8,7 +8,7 @@ import dashboard from '@/views/dashboard/index.vue'
|
||||
import setting from '@/views/setting/index.vue'
|
||||
import { watchRouter } from './watch'
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: createWebHashHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/login',
|
||||
|
||||
Reference in New Issue
Block a user