feat(deployment): allow deploy to vercel

This commit is contained in:
Kentai Radiquum 2024-05-15 19:40:18 +05:00
parent f4e340b21d
commit f3a15eb956
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
3 changed files with 23 additions and 0 deletions

View file

@ -1,3 +1,5 @@
import os
import uvicorn import uvicorn
from fastapi import FastAPI from fastapi import FastAPI
from modules import proxy from modules import proxy
@ -38,6 +40,9 @@ TAGS = [
PREFIX = "/v1" PREFIX = "/v1"
if os.getenv("API_PREFIX"):
PREFIX = os.getenv("API_PREFIX")
app = FastAPI( app = FastAPI(
openapi_tags=TAGS, openapi_tags=TAGS,
title="AniX API", title="AniX API",

14
backend/vercel.json Normal file
View file

@ -0,0 +1,14 @@
{
"builds": [
{
"src": "main.py",
"use": "@vercel/python"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "main.py"
}
]
}

View file

@ -1,5 +1,9 @@
export let API_URL = "/api/v1"; export let API_URL = "/api/v1";
if (process.env.API_URL) {
API_URL = process.env.API_URL;
}
export const endpoints = { export const endpoints = {
index: { index: {
last: `${API_URL}/index/last`, last: `${API_URL}/index/last`,