Browse Source

Merge pull request #360 from wingkwong/docs/noco-docs

refactor(docs): fix page structure and revise content
pull/362/head
o1lab 3 years ago committed by GitHub
parent
commit
0ec3483f0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 50
      packages/noco-docs/content/en/developer-resources/graphql-apis.md
  2. 128
      packages/noco-docs/content/en/developer-resources/rest-apis.md
  3. 57
      packages/noco-docs/content/en/getting-started/faqs.md
  4. 47
      packages/noco-docs/content/en/setup-and-usages/apis-access.md
  5. 20
      packages/noco-docs/content/en/setup-and-usages/environment-variables.md
  6. 55
      packages/noco-docs/content/en/setup-and-usages/installation.md

50
packages/noco-docs/content/en/developer-resources/graphql-apis.md

@ -2,31 +2,31 @@
title: 'GraphQL APIs' title: 'GraphQL APIs'
position: 2 position: 2
category: 'Developer Resources' category: 'Developer Resources'
fullscreen: true
menuTitle: 'GraphQL APIs' menuTitle: 'GraphQL APIs'
--- ---
# Features
* APIs ## Features
* Generates GraphQL APIs for **ANY** MySql, Postgres, MSSQL, Sqlite database :fire:
* Serves GraphQL queries irrespective of naming conventions of primary keys, foreign keys, tables etc :fire: * Generates GraphQL APIs for **ANY** MySql, Postgres, MSSQL, Sqlite database :fire:
* Support for composite primary keys :fire: * Serves GraphQL queries irrespective of naming conventions of primary keys, foreign keys, tables etc :fire:
* Usual suspects : CRUD, List, FindOne, Count, Exists, Distinct * Support for composite primary keys :fire:
* Pagination * Usual suspects : CRUD, List, FindOne, Count, Exists, Distinct
* Sorting * Pagination
* Column filtering - Fields :fire: * Sorting
* Row filtering - Where :fire: * Column filtering - Fields :fire:
* Bulk insert, Bulk delete, Bulk read :fire: * Row filtering - Where :fire:
* Relations - automatically detected * Bulk insert, Bulk delete, Bulk read :fire:
* Aggregate functions * Relations - automatically detected
* More * Aggregate functions
* Upload single file * More
* Upload multiple files * Upload single file
* Download file * Upload multiple files
* Download file
* Authentication * Authentication
* Access Control * Access Control
# GraphQL API Overview ## API Overview
### Query ### Query
@ -54,7 +54,7 @@ menuTitle: 'GraphQL APIs'
| [TableName**UpdateBulk**](#tablenamebulk) | data: [TableNameInput] | [Int] | Bulk row update | | [TableName**UpdateBulk**](#tablenamebulk) | data: [TableNameInput] | [Int] | Bulk row update |
| [TableName**DeleteBulk**](#tablenamedeletebulk) | data: [TableNameInput] | [Int] | Bulk row delete | | [TableName**DeleteBulk**](#tablenamedeletebulk) | data: [TableNameInput] | [Int] | Bulk row delete |
## Query Arguments ### Query params
| **Param** | **Description** | **Default value** |**Example Value**| | **Param** | **Description** | **Default value** |**Example Value**|
|---|---|---|---| |---|---|---|---|
@ -86,7 +86,6 @@ like - 'like' - (colName,like,%name)
PaymentList(where:"(checkNumber,eq,JM555205)~or((amount,gt,200)~and(amount,lt,2000))") PaymentList(where:"(checkNumber,eq,JM555205)~or((amount,gt,200)~and(amount,lt,2000))")
``` ```
#### Logical operators #### Logical operators
``` ```
~or - 'or' ~or - 'or'
@ -94,6 +93,8 @@ PaymentList(where:"(checkNumber,eq,JM555205)~or((amount,gt,200)~and(amount,lt,20
~not - 'not' ~not - 'not'
``` ```
## Examples
### TableNameList ### TableNameList
<code-group> <code-group>
@ -243,13 +244,6 @@ CountryList {
</code-group> </code-group>
#### List + where + sort + offset #### List + where + sort + offset
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>

128
packages/noco-docs/content/en/developer-resources/rest-apis.md

@ -2,39 +2,33 @@
title: 'REST APIs' title: 'REST APIs'
position: 1 position: 1
category: 'Developer Resources' category: 'Developer Resources'
fullscreen: true
menuTitle: 'REST APIs' menuTitle: 'REST APIs'
--- ---
# Table of Content
* [Features](#features) ## Features
* [APIs overview](#api-overview)
* [Authentication](#authentication)
* [Access Control](#acess-control)
* [Migrations](#migrations)
# Features
* **Automatic REST APIs for any SQL database** * **Automatic REST APIs for any SQL database**
* Generates REST APIs for **ANY** MySql, Postgres, MSSQL, Sqlite database :fire: * Generates REST APIs for **ANY** MySql, Postgres, MSSQL, Sqlite database
* Serves APIs irrespective of naming conventions of primary keys, foreign keys, tables etc :fire: * Serves APIs irrespective of naming conventions of primary keys, foreign keys, tables etc
* Support for composite primary keys :fire: * Support for composite primary keys
* REST APIs : * REST APIs :
* CRUD, List, FindOne, Count, Exists, Distinct (Usual suspects) * CRUD, List, FindOne, Count, Exists, Distinct (Usual suspects)
* Pagination * Pagination
* Sorting * Sorting
* Column filtering - Fields :fire: * Column filtering - Fields
* Row filtering - Where :fire: * Row filtering - Where
* Bulk insert, Bulk delete, Bulk read :fire: * Bulk insert, Bulk delete, Bulk read
* Relations - automatically detected * Relations - automatically detected
* Aggregate functions * Aggregate functions
* More * More
* Upload single file * Upload single file
* Upload multiple files * Upload multiple files
* Download file * Download file
* **Authentication** * Authentication
* **Access Control** * Access Control
# API Overview ## API Overview
| **Method** | **Path** | **Query Params** | **Description** | | **Method** | **Path** | **Query Params** | **Description** |
|---|---|---|---| |---|---|---|---|
@ -62,7 +56,6 @@ menuTitle: 'REST APIs'
</em> </em>
</alert> </alert>
### HasMany APIs ### HasMany APIs
| **Method** | **Path** | **Query Params** | **Description** | | **Method** | **Path** | **Query Params** | **Description** |
@ -98,7 +91,7 @@ menuTitle: 'REST APIs'
</em> </em>
</alert> </alert>
## Query params ### Query params
| **Name** | **Alias** | **Use case** | **Default value** |**Example value** | | **Name** | **Alias** | **Use case** | **Default value** |**Example value** |
@ -140,9 +133,9 @@ like - 'like' - (colName,like,%name)
``` ```
### Examples ## Examples
#### List ### List
<code-group> <code-group>
@ -169,7 +162,7 @@ like - 'like' - (colName,like,%name)
#### List + where ### List + where
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
@ -240,7 +233,7 @@ GET /api/v1/country?where=(country,like,United%)&sort=-country
</code-group> </code-group>
#### List + where + sort + offset ### List + where + sort + offset
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
@ -270,7 +263,7 @@ GET /api/v1/country?where=(country,like,United%)&sort=-country&offset=1
</code-group> </code-group>
#### List + limit ### List + limit
<code-group> <code-group>
@ -389,7 +382,10 @@ POST /api/v1/country
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
```PUT /api/v1/country/1``` ```
PUT /api/v1/country/1
```
``` ```
{ {
"country": "Afghanistan1" "country": "Afghanistan1"
@ -397,7 +393,7 @@ POST /api/v1/country
``` ```
</code-block> </code-block>
<code-block label="Response"> <code-block label="Response">
```json ```json
{ {
@ -429,6 +425,7 @@ true
``` ```
</code-block> </code-block>
</code-group> </code-group>
[](#api-overview) [](#api-overview)
@ -629,24 +626,29 @@ GET /api/v1/country/count
"count": 161 "count": 161
} }
``` ```
[](#api-overview) </code-block>
</code-group>
[](#api-overview)
### Bulk Insert ### Bulk Insert
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
```POST /api/v1/country/bulk``` ```
POST /api/v1/country/bulk
```
```json ```json
[ [
{ {
"country": "test 1" "country": "test 1"
}, },
{ {
"country": "test 2" "country": "test 2"
} }
] ]
``` ```
</code-block> </code-block>
@ -659,6 +661,7 @@ GET /api/v1/country/count
``` ```
</code-block> </code-block>
</code-group> </code-group>
[](#api-overview) [](#api-overview)
@ -666,7 +669,10 @@ GET /api/v1/country/count
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
```PUT /api/v1/country/bulk``` ```
PUT /api/v1/country/bulk
```
```json ```json
[ [
{ {
@ -690,6 +696,7 @@ GET /api/v1/country/count
``` ```
</code-block> </code-block>
</code-group> </code-group>
[](#api-overview) [](#api-overview)
@ -698,7 +705,10 @@ GET /api/v1/country/count
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
```DELETE /api/v1/country/bulk``` ```
DELETE /api/v1/country/bulk
```
```json ```json
[ [
{ {
@ -720,6 +730,7 @@ GET /api/v1/country/count
``` ```
</code-block> </code-block>
</code-group> </code-group>
[](#api-overview) [](#api-overview)
@ -790,7 +801,10 @@ GET /api/v1/country/1/city
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
```POST /api/v1/country/1/city``` ```
POST /api/v1/country/1/city
```
```json ```json
{ {
"city": "test" "city": "test"
@ -817,7 +831,9 @@ GET /api/v1/country/1/city
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
```GET /api/v1/country/1/city/findOne?where=(city,like,ka%)``` ```
GET /api/v1/country/1/city/findOne?where=(city,like,ka%)
```
</code-block> </code-block>
<code-block label="Response"> <code-block label="Response">
@ -891,7 +907,10 @@ GET /api/v1/country/1/city/251
<code-group> <code-group>
<code-block label="Request" active> <code-block label="Request" active>
```POST /api/v1/country/1/city/251``` ```
POST /api/v1/country/1/city/251
```
``` ```
{ {
"city": "Kabul-1" "city": "Kabul-1"
@ -943,6 +962,7 @@ GET /api/v1/country/has/city
[](#belongsto-apis) [](#belongsto-apis)
### Get table and parent class within ### Get table and parent class within
<code-group> <code-group>

57
packages/noco-docs/content/en/getting-started/faqs.md

@ -0,0 +1,57 @@
---
title: 'FAQs'
description: 'FAQs'
position: 2
category: 'Getting started'
fullscreen: true
menuTitle: 'FAQs'
---
## Which are the supported databases ?
Currently we supports most ost of the SQL databases Postgres, MySQL, MariaDB, SQL Server and SQLite3.
## Is it completely free ?
Currently you can use the product without any cost
## Which platforms it supports ?
You can run it any machine with help of Node or Docker
## Are the APIs secure - does it have Auth and ACL ?
NocoDB is fully secure with built in session based authentication and authorisation. We currently support Google and Facebook Authorisation.
Authentication also covers things related to email verification, forgot password & reset password. Support for 3rd party Auth libraries Auth0, Firebase, Amazon Cognito will be there in future.
## Is it possible to ignore certain tables from the view ?
Yes, you can disable it from the UI
## Is Access Control List (ACL) or Role Based Access Control (RBAC) ?
NocoDB not only auto generates access control list for all the tables but also provides GUI to manage these permissions for each category of users and models. Again, these ACL are done in really modular way such that each ACL file is associated with its corresponding router and middleware file.
ACL/RBAC enables developer to manage fine grained access to underlying models to various category of users.
## Does APIs have pagination ?
Yes all APIs have built in pagination.
## Is there support for Swagger API specification for REST APIs ?
NocoDB automatically generates swagger documentation for all the REST APIs so that you have to never write one from scartch! Generated documentation is done in a really modular way so that each router file is associated with a swagger documentation. This makes it really easy to follow and update.
Swagger is the most adapted open source API documentation. Swagger's interactive live documentation not only helps developer to understand APIs but also to invoke the APIs.
## Can the APIs resist SQL injection attacks ?
Prepared SQL queries which are safe are executed when data is fetched from Database.
## How to data validation for models ?
You can write really complex and data validation function within the models generated for you.
## I have more questions ?
Please join our wonderful community at [discord](https://discord.gg/5RgZmkW).

47
packages/noco-docs/content/en/setup-and-usages/apis-access.md

@ -0,0 +1,47 @@
---
title: 'APIs Access'
description: 'APIs Access'
position: 4
category: 'Setup and Usages'
menuTitle: 'APIs Access'
---
## REST APIs
- Go to NocoDB Project, click the rightmost button and click ``Copy auth token``.
![image](https://user-images.githubusercontent.com/35857179/126187328-745943f2-c780-4109-b967-1b3f1c4a1dcd.png)
- Click the same button and click ``Swagger APIs Doc``.
![image](https://user-images.githubusercontent.com/35857179/126187534-32c41de9-f17d-4f95-9acc-88aaed044b36.png)
- Select ``Schemes`` and Click ``Authorize``.
![image](https://user-images.githubusercontent.com/35857179/126188482-f3aacabf-dbc5-41a8-a190-9f225347ebd1.png)
- Paste the token you just copy in step 1 and click Authorize
![image](https://user-images.githubusercontent.com/35857179/126188510-b3790348-6809-4182-911a-a4031ace2fd2.png)
## GraphQL APIs
- Go to NocoDB Project, click the rightmost button and click ``Copy auth token``.
![image](https://user-images.githubusercontent.com/35857179/126187624-03ee550d-71eb-499f-ad8b-54e32a94f729.png)
- Click the same button and click ``GraphQL APIs`.
![image](https://user-images.githubusercontent.com/35857179/126187581-22503b8d-f6dd-4a4e-8b12-a475c27354a2.png)
- Click ``REQUEST HEADERS``.
![image](https://user-images.githubusercontent.com/35857179/126188122-1aa7b153-f05a-46fd-953b-751376d708bf.png)
- Paste the token you just copy in step 1.
```json
{
"xc-auth": "YOUR_AUTH_TOKEN"
}
```

20
packages/noco-docs/content/en/setup-and-usages/environment-variables.md

@ -0,0 +1,20 @@
---
title: 'Environment Variables'
description: 'Environment Variables'
position: 3
category: 'Setup and Usages'
fullscreen: true
menuTitle: 'Environment Variables'
---
| Variable | Mandatory | Comments | If absent |
|-------------------------|-----------|----------------------------------------------------------------------------------|--------------------------------------------|
| NC_DB | Yes | See our database URLs | A local SQLite will be created in root folder |
| DATABASE_URL | No | JDBC URL Format. Can be used instead of NC_DB. Used in 1-Click Heroku deployment| |
| DATABASE_URL_FILE | No | path to file containing JDBC URL Format. Can be used instead of NC_DB. Used in 1-Click Heroku deployment| |
| NC_PUBLIC_URL | Yes | Used for sending Email invitations | Best guess from http request params |
| NC_AUTH_JWT_SECRET | Yes | JWT secret used for auth and storing other secrets | A Random secret will be generated |
| NC_SENTRY_DSN | No | For Sentry monitoring | |
| NC_CONNECT_TO_EXTERNAL_DB_DISABLED | No | Disable Project creation with external database | |
| NC_DISABLE_TELE | No | Disable telemetry | |
| NC_BACKEND_URL | No | Custom Backend URL | ``http://localhost:8080`` will be used |

55
packages/noco-docs/content/en/setup-and-usages/installation.md

@ -3,24 +3,25 @@ title: 'Setup and Usages'
description: 'Simple installation - takes about three minutes!' description: 'Simple installation - takes about three minutes!'
position: 1 position: 1
category: 'Setup and Usages' category: 'Setup and Usages'
fullscreen: true
menuTitle: 'Installation' menuTitle: 'Installation'
link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme=dark link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme=dark
--- ---
## Simple installation - takes about three minutes! Simple installation - takes about three minutes!
### Prerequisites ## Prerequisites
- __Must haves__ - __Must haves__
* [node.js >= 12](https://nodejs.org/en/download) / [Docker](https://www.docker.com/get-started) * [node.js >= 12](https://nodejs.org/en/download) / [Docker](https://www.docker.com/get-started)
* [MySql](https://dev.mysql.com/downloads/mysql/) / [Postgres](https://www.postgresql.org/download/) / [SQLserver](https://www.microsoft.com/en-gb/sql-server/sql-server-downloads) / SQLite Database * [MySql](https://dev.mysql.com/downloads/mysql/) / [Postgres](https://www.postgresql.org/download/) / [SQLserver](https://www.microsoft.com/en-gb/sql-server/sql-server-downloads) / SQLite Database
- Nice to haves - Nice to haves
- Existing schemas can help to create APIs quickly. - Existing schemas can help to create APIs quickly.
- An example database schema can be found : <a class="grey--text" href="https://github.com/lerocha/chinook-database/tree/master/ChinookDatabase/DataSources"> <u>here</u> </a> - An example database schema can be found <a class="grey--text" href="https://github.com/lerocha/chinook-database/tree/master/ChinookDatabase/DataSources"> <u>here</u></a>.
## Quick try ## Quick try
### 1-Click Deploy
### 1-Click Deploy to Heroku
<a href="https://heroku.com/deploy?template=https://github.com/npgia/nocodb-seed-heroku"> <a href="https://heroku.com/deploy?template=https://github.com/npgia/nocodb-seed-heroku">
<img <img
src="https://www.herokucdn.com/deploy/button.svg" src="https://www.herokucdn.com/deploy/button.svg"
@ -29,7 +30,7 @@ link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme
/> />
</a> </a>
### Node app or docker ### Node app / Docker
<code-group> <code-group>
@ -61,17 +62,49 @@ link: https://codesandbox.io/embed/vigorous-firefly-80kq5?hidenavigation=1&theme
</code-block> </code-block>
</code-group> </code-group>
<br> <br>
<br> <br>
# Production Setup ## Local Setup
If you want to modify the source code, there are two scenarios. You can either
- change backend only or
- change both frontend and backend separately
Even though the package ``nocodb/packages/nocodb`` is a backend project, you can still visit the dashboard as it includes ``nc-lib-gui``.
```bash
cd packages/nocodb
npm install
npm run watch:run
# open localhost:8080/dashboard in browser
```
As ``nc-lib-gui`` is hosted in npm registry, for local development on frontend part, you should run ``nc-gui`` separately.
```bash
cd packages/nc-gui
npm install
npm run dev
# open localhost:3000/dashboard in browser
```
If you wish to combine the frontend and backend together in your local devlopment environment, you may use ``packages/nc-lib-gui`` as a local depenedency by updating the ``packages/nocodb/package.json`` to
```json
"nc-lib-gui": "file:../nc-lib-gui"
```
In this case, whenever there is any changes made in frontend, you need to run ``npm run build:copy`` under ``packages/nc-gui/``.
## Production Setup
NocoDB requires a database to store metadata of spreadsheets views and external databases. NocoDB requires a database to store metadata of spreadsheets views and external databases.
And connection params for this database can be specified in `NC_DB` environment variable. And connection params for this database can be specified in `NC_DB` environment variable.
## Docker ### Docker
<code-group> <code-group>
<code-block label="MySQL" active> <code-block label="MySQL" active>
@ -108,7 +141,7 @@ And connection params for this database can be specified in `NC_DB` environment
</code-block> </code-block>
</code-group> </code-group>
## Docker Compose ### Docker Compose
<code-group> <code-group>
<code-block label="MySQL" active> <code-block label="MySQL" active>

Loading…
Cancel
Save