test front
This commit is contained in:
parent
798fc92f21
commit
768bea9967
|
@ -19,4 +19,6 @@ RUN poetry install
|
|||
|
||||
COPY . ${WORKING_DIR}
|
||||
|
||||
RUN cd front && npm install && npm run generate
|
||||
RUN cd ..
|
||||
CMD poetry run uvicorn app.main:app --host 0.0.0.0 --port 80
|
25
app/main.py
25
app/main.py
|
@ -5,9 +5,12 @@ from datetime import datetime
|
|||
import locale
|
||||
|
||||
from urllib.parse import parse_qs
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
from app.constants import *
|
||||
|
||||
|
@ -198,3 +201,25 @@ async def deal_tab(
|
|||
except Exception as e:
|
||||
logger.error(e)
|
||||
return {"status": "error"}
|
||||
|
||||
# app.mount("/widget", StaticFiles(directory="front/dist", html=True), name="static")
|
||||
|
||||
NUXT_DIST = Path("front/dist")
|
||||
|
||||
@app.post("/widget")
|
||||
async def handle_widget_post(request: Request):
|
||||
# Обработка данных POST-запроса
|
||||
# data = await request.json()
|
||||
|
||||
# Загружаем сгенерированный HTML (например, index.html)
|
||||
body = await request.body()
|
||||
b_str = body.decode()
|
||||
result = parse_qs(b_str)
|
||||
|
||||
logger.info(result)
|
||||
|
||||
html_file = NUXT_DIST / "index.html"
|
||||
if html_file.exists():
|
||||
html_content = html_file.read_text()
|
||||
return HTMLResponse(content=html_content, status_code=200)
|
||||
return {"error": "Nuxt.js page not found"}, 404
|
|
@ -0,0 +1,24 @@
|
|||
# Nuxt dev/build outputs
|
||||
.output
|
||||
.data
|
||||
.nuxt
|
||||
.nitro
|
||||
.cache
|
||||
dist
|
||||
|
||||
# Node dependencies
|
||||
node_modules
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.fleet
|
||||
.idea
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
|
@ -0,0 +1,75 @@
|
|||
# Nuxt Minimal Starter
|
||||
|
||||
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
||||
|
||||
## Setup
|
||||
|
||||
Make sure to install dependencies:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm install
|
||||
|
||||
# pnpm
|
||||
pnpm install
|
||||
|
||||
# yarn
|
||||
yarn install
|
||||
|
||||
# bun
|
||||
bun install
|
||||
```
|
||||
|
||||
## Development Server
|
||||
|
||||
Start the development server on `http://localhost:3000`:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run dev
|
||||
|
||||
# pnpm
|
||||
pnpm dev
|
||||
|
||||
# yarn
|
||||
yarn dev
|
||||
|
||||
# bun
|
||||
bun run dev
|
||||
```
|
||||
|
||||
## Production
|
||||
|
||||
Build the application for production:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run build
|
||||
|
||||
# pnpm
|
||||
pnpm build
|
||||
|
||||
# yarn
|
||||
yarn build
|
||||
|
||||
# bun
|
||||
bun run build
|
||||
```
|
||||
|
||||
Locally preview production build:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run preview
|
||||
|
||||
# pnpm
|
||||
pnpm preview
|
||||
|
||||
# yarn
|
||||
yarn preview
|
||||
|
||||
# bun
|
||||
bun run preview
|
||||
```
|
||||
|
||||
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
|
@ -0,0 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<NuxtRouteAnnouncer />
|
||||
<NuxtWelcome />
|
||||
</div>
|
||||
</template>
|
|
@ -0,0 +1,10 @@
|
|||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: '2024-04-03',
|
||||
devtools: { enabled: true },
|
||||
app: {
|
||||
baseURL: '/widget/', // Базовый путь
|
||||
// buildAssetsDir: '/widget/_nuxt/', // Путь для статических файлов
|
||||
},
|
||||
|
||||
})
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "nuxt-app",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "nuxt build",
|
||||
"dev": "nuxt dev",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt": "^3.14.1592",
|
||||
"vue": "latest",
|
||||
"vue-router": "latest"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../.nuxt/tsconfig.server.json"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
// https://nuxt.com/docs/guide/concepts/typescript
|
||||
"extends": "./.nuxt/tsconfig.json"
|
||||
}
|
Loading…
Reference in New Issue