feat: 后端初始化
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# supplied-service
|
||||
|
||||
Netlify Functions backend for the supplied mall H5 project.
|
||||
|
||||
## Stack
|
||||
|
||||
- Netlify Functions
|
||||
- TypeScript
|
||||
- Prisma ORM
|
||||
- Neon Postgres
|
||||
- `@prisma/adapter-neon` + `@neondatabase/serverless`
|
||||
|
||||
## Directory
|
||||
|
||||
```text
|
||||
netlify/
|
||||
functions/ # API entrypoints
|
||||
utils/ # shared function utilities
|
||||
types/ # shared API types
|
||||
prisma/
|
||||
schema.prisma # Prisma models
|
||||
```
|
||||
|
||||
## Environment
|
||||
|
||||
Copy `.env.example` to `.env` and set:
|
||||
|
||||
- `DATABASE_URL`: pooled Neon connection string for Netlify Functions runtime
|
||||
- `DIRECT_URL`: direct Neon connection string for Prisma CLI and migrations
|
||||
- `JWT_SECRET`: auth signing secret
|
||||
- `UPLOAD_TOKEN`: upload guard token
|
||||
|
||||
## Scripts
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
npm run build
|
||||
npm run typecheck
|
||||
npm run prisma:generate
|
||||
npm run prisma:migrate
|
||||
npm run prisma:studio
|
||||
```
|
||||
|
||||
## Function Routes
|
||||
|
||||
Netlify exposes functions under `/.netlify/functions/<name>`.
|
||||
|
||||
Current placeholders:
|
||||
|
||||
- `login`
|
||||
- `product-list`
|
||||
- `product-detail`
|
||||
- `cart-add`
|
||||
- `order-create`
|
||||
- `order-pay`
|
||||
- `user-info`
|
||||
- `upload`
|
||||
Reference in New Issue
Block a user