feat: 城中村租房平台 - 租客浏览、房东发布房源、图片上传

This commit is contained in:
Cuishibing
2026-03-22 10:15:31 +08:00
parent f03cf328dd
commit ce9dfae7c5
15 changed files with 1682 additions and 87 deletions

View File

@@ -0,0 +1,17 @@
import { NextResponse } from 'next/server';
import fs from 'fs/promises';
import path from 'path';
const DATA_DIR = path.join(process.cwd(), 'data');
const DISTRICTS_FILE = path.join(DATA_DIR, 'districts.json');
export async function GET() {
try {
const data = await fs.readFile(DISTRICTS_FILE, 'utf-8');
const districts = JSON.parse(data);
return NextResponse.json({ districts });
} catch (error) {
console.error('Get districts error:', error);
return NextResponse.json({ districts: [] });
}
}