58 lines
1.0 KiB
Markdown
58 lines
1.0 KiB
Markdown
# 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`
|