Update README.md

pull/9078/head
alannnc 2022-04-20 18:34:27 -06:00 committed by GitHub
parent a2cdb04985
commit 3c9f6f2db1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 12 deletions

View File

@ -11,30 +11,37 @@ Basically there's three places of the codebase you need to think about for each
## The example resource -model- and it's endpoints ## The example resource -model- and it's endpoints
### `pages/api/endpoint/` ### `pages/api/endpoint/`
| Method | route | action |
GET pages/api/endpoint/index.ts - Read All of your resource | ------ | ----- | ----- |
POST pages/api/endpoint/new.ts - Create new resource | GET | pages/api/endpoint/index.ts | Read All of your resource |
| POST |pages/api/endpoint/new.ts | Create new resource |
### `pages/api/endpoint/[id]/` ### `pages/api/endpoint/[id]/`
GET pages/api/endpoint/[id]/index.ts - Read All of your resource | Method | route | action |
PATCH pages/api/endpoint/[id]/edit.ts - Create new resource | ------ | --------------------------------- | ------------------------- |
DELETE pages/api/endpoint/[id]/delete.ts - Create new resource | GET | pages/api/endpoint/[id]/index.ts | Read All of your resource |
| PATCH | pages/api/endpoint/[id]/edit.ts | Create new resource |
| DELETE | pages/api/endpoint/[id]/delete.ts | Create new resource |
## `/tests/` ## `/tests/`
This is where all your endpoint's tests live, we mock prisma calls. We aim for at least 50% global coverage. Test each of your endpoints. This is where all your endpoint's tests live, we mock prisma calls. We aim for at least 50% global coverage. Please test each of your endpoints.
### `/tests/endpoint/` ### `/tests/endpoint/`
/tests/endpoint/resource.index.test.ts - Test for your pages/api/endpoint/index.ts file | route | action |
tests/endpoint/resource.new.test.ts - Create new resource | -------------------------------------- | ---------------------------------------------- |
| /tests/endpoint/resource.index.test.ts | Test for your pages/api/endpoint/index.ts file |
| tests/endpoint/resource.new.test.ts | Create new resource |
### `/tests/endpoint/[id]/` ### `/tests/endpoint/[id]/`
`/tests/endpoint/[id]/resource.index.test.ts` - Read All of your resource | route | action |
`/tests/endpoint/[id]/resource.edit.test.ts` - Create new resource | ---------------------------------------------- | ------------------------- |
`/tests/endpoint/[id]/resource.delete.test.ts` - Create new resource | `/tests/endpoint/[id]/resource.index.test.ts` | Read All of your resource |
| `/tests/endpoint/[id]/resource.edit.test.ts` | Create new resource |
| `/tests/endpoint/[id]/resource.delete.test.ts` | Create new resource |
## `/lib/validations/yourEndpoint.ts` ## `/lib/validations/yourEndpoint.ts`