docs(api): add doc for Strapi server

This commit is contained in:
nathan-pichon 2023-02-14 18:18:25 +01:00
parent acb2f190b0
commit 2ec478af3c
No known key found for this signature in database
2 changed files with 65 additions and 1 deletions

27
docs/docs/api/api.mdx Normal file
View File

@ -0,0 +1,27 @@
---
title: API
slug: /api/API
tags:
- module
- public
toc_min_heading_level: 2
toc_max_heading_level: 3
---
import Type from '@site/docs/api/components/Type';
# API
:::info
Current state: **Stable**
:::
The Strapi API module permits to generate a Strapi API object that wrap all the functionalities around Strapi endpoints
## Module: API
### `createAPI(strapi, opts)`
// TODO

View File

@ -34,13 +34,50 @@ server.listRoutes();
```
### `StrapiServer.app`
[<Type>KoaJS</Type>](https://devdocs.io/koa/index) https://devdocs.io/koa/index
Strapi projects are using KoaJS to run the NodeJS server.
### `StrapiServer.router`
[<Type>@koa/router</Type>](https://github.com/ZijianHe/koa-router#router-) https://github.com/ZijianHe/koa-router#router-
Strapi projects are using a dependency of KoaJS called @koa/router.
### `StrapiServer.httpServer`
[<Type>http.Server</Type>](https://nodejs.org/docs/latest-v18.x/api/http.html)
The Strapi's HTTP server.
### `StrapiServer.api(name)`
- `name`: <Type>String</Type>
- Returns: [<Type>StrapiAPIs</Type>](#strapiapis)
Getter for apis available in Strapi
### `StrapiServer.use(...args)`
[<Type>KoaApp.use</Type>](https://devdocs.io/koa/index#appusefunction) https://devdocs.io/koa/index#appusefunction
Shortcut for Koa `app.use(...args)` method.
### `StrapiServer.routes(routes)`
### `StrapiServer.mount()`
### `StrapiServer.initRouting()`
### `StrapiServer.initMiddlewares()`
### `StrapiServer.listRoutes()`
### `StrapiServer.listen(...args)`
### `StrapiServer.listen(...args)`
### `StrapiServer.destroy()`
### `StrapiAPIs`
<Type>Object</Type>
- `content-api`: [<Type>API</Type>](API)
- API used by external requesters
- `admin`: [<Type>API</Type>](API)
- API used by admin panel
Strapi APIs is a map of all APIs available inside the Strapi project.