63 lines
2.1 KiB
Markdown
63 lines
2.1 KiB
Markdown
# WanderQ Travel
|
|
|
|
万趣旅行贵州网站是一个代码维护内容的双语 React 前台。内容修改通过 TypeScript 文件完成,构建后直接发布,不提供管理后台或 CMS 写入接口。
|
|
|
|
## Stack
|
|
|
|
- React + TypeScript + Vite frontend
|
|
- Code-defined bilingual content in `src/siteContent.ts`, `src/guizhouContent.ts`, and `src/guizhouEnContent.ts`
|
|
- CMS-shaped static view model assembled by `src/cms.ts`
|
|
- Minimal Node HTTP API for inquiry notification delivery
|
|
|
|
## Scripts
|
|
|
|
```bash
|
|
npm run dev
|
|
npm run api
|
|
npm run dev:full
|
|
npm run lint
|
|
npm run build
|
|
npm run preview
|
|
```
|
|
|
|
`npm run dev:full` starts the Vite frontend and the inquiry API together. The frontend proxies `/api` to `http://127.0.0.1:5174` during local development.
|
|
|
|
## Inquiry notification API
|
|
|
|
The public form posts to `POST /api/inquiries`. The API does not store inquiries. It validates the request and forwards an `inquiry.submitted` event to the configured notification webhook. If no webhook is configured, or the webhook rejects the event, the API returns an error so the frontend does not report a lost inquiry as successful.
|
|
|
|
Configure the deployment with:
|
|
|
|
```bash
|
|
INQUIRY_NOTIFICATION_URL="https://notification.example.com/inquiries"
|
|
INQUIRY_NOTIFICATION_AUTH_HEADER="Bearer optional-token"
|
|
INQUIRY_ALLOWED_ORIGIN="https://www.wanderq.com"
|
|
INQUIRY_API_PORT=5174
|
|
```
|
|
|
|
The webhook receives JSON in this shape:
|
|
|
|
```json
|
|
{
|
|
"type": "inquiry.submitted",
|
|
"occurredAt": "2026-07-23T00:00:00.000Z",
|
|
"data": {
|
|
"id": "inq-example",
|
|
"receivedAt": "2026-07-23T00:00:00.000Z",
|
|
"name": "Guest name",
|
|
"contact": "guest@example.com",
|
|
"interest": "Classic Guizhou landscapes · USD 3,000-5,000",
|
|
"travelMonth": "October 2026",
|
|
"guests": "2",
|
|
"message": "Additional notes",
|
|
"locale": "en"
|
|
}
|
|
}
|
|
```
|
|
|
|
Use `GET /api/health` to verify the API and whether a notification destination is configured.
|
|
|
|
## Maintaining content
|
|
|
|
Production raster images are hosted in OSS and referenced from `src/guizhouContent.ts`; local `public/` assets are limited to SVG/HTML files and the OSS manifest. Edit the tracked TypeScript content, then run `npm run lint` and `npm run build` before deploying.
|