62 lines
1.3 KiB
Markdown
62 lines
1.3 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`: Neon Postgres connection string for Netlify Functions runtime and Prisma CLI
|
|
- `JWT_SECRET`: auth signing secret
|
|
- `UPLOAD_TOKEN`: upload guard token
|
|
- `POINTS_MALL_OPEN_API_BASE`: main platform bridge base URL, for example `http://localhost/open`
|
|
|
|
Supplier H5 uses `VUE_APP_SUPPLIER_IDENTIFICATION` to request supplier config from this service. The supplier `clientSecret` stays in the database and is only used by the Netlify Function when requesting the platform bridge 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`
|
|
- `supplier-info`
|
|
- `supplier-token`
|