Skip to content

Commit

Permalink
Update general-usage.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus Alexander Strømseng authored and GitHub committed Apr 14, 2024
1 parent 90493cb commit 5530379
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions docs/general-usage.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
### 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

```
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

Expand Down

0 comments on commit 5530379

Please sign in to comment.