From 5530379386ed0eea5a30e74eb7bfb5774e623fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Alexander=20Str=C3=B8mseng?= Date: Sun, 14 Apr 2024 13:59:26 +0200 Subject: [PATCH] Update general-usage.md --- docs/general-usage.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/general-usage.md b/docs/general-usage.md index becad5b..a9106eb 100644 --- a/docs/general-usage.md +++ b/docs/general-usage.md @@ -1,14 +1,4 @@ -### Type generation - -###### REST - -When updating a schema in Strapi, you have to run `npm run generateTypes` in the root directory to generate the proper types for the frontend. - -> This uses Strapi's official [documentation plugin](https://docs.strapi.io/dev-docs/plugins/documentation) to generate documentation matching the [OpenAPI specification](https://swagger.io/specification/). It then uses the [@openapi-typescript](https://www.npmjs.com/package/openapi-typescript) package to generate the typescript types. -> -> The generated documentation can be found at [http://localhost:1337/documentation/v1.0.0](http://localhost:1337/documentation/v1.0.0) when running the dev server. - -###### GraphQL +### GraphQL Type generation If you're using GraphQL, then you need to run `npm run compile` from `/frontend` whenever you update a schema or define a new graphQL request in the code. Make sure to import the correct `gql` as @@ -16,11 +6,25 @@ If you're using GraphQL, then you need to run `npm run compile` from `/frontend` import { gql } from"@/generated/gql"; ``` +> Any errors in your code other than the GraphQL types, can result in the codegen not working, so make sure to fix all other errors before running the codegen. + > [https://www.apollographql.com/docs/react/development-testing/static-typing/](https://www.apollographql.com/docs/react/development-testing/static-typing/) ### Strapi First time boot -Goto Settings > Users & Permissions plugin > Roles > Public > Article, and enable `find` and `findOne` +Goto Settings > Users & Permissions plugin > Roles > Public > Article, and enable `find` and `findOne`. You need to do this for every publically available content type. Theese include but are not limited to: +- Article +- Author +- Hero +- Most-recent-image +- Project +- Satellite + +The following should **NOT** be made publicly available: +- Email +- i18n +- Upload +- User-permissions ### Heroku