Merge pull request #4575 from strapi/docs-fixes

Some documentation update
This commit is contained in:
Jim LAURIE 2019-11-26 11:58:01 +01:00 committed by GitHub
commit 64aa3690d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 104 additions and 175 deletions

View File

@ -481,7 +481,7 @@ As an example using this configuration with Nginx your server would respond to `
For security reasons, sometimes it's better to set variables through the server environment. It's also useful to push dynamics values into configurations files. To enable this feature into JSON files, Strapi embraces a JSON-file interpreter into his core to allow dynamic value in the JSON configurations files.
### Syntax
#### Syntax
The syntax is inspired by the [template literals ES2015 specifications](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals). These dynamic values are indicated by the Dollar sign and curly braces (`${expression}`).

View File

@ -66,9 +66,9 @@ Here is the list of endpoints generated for each of your **Content Types**
| Method | Path | Description |
| :----- | :---------------------------------------------- | :----------------------------------- |
| GET | [/{content-type}](#get-restaurants) | Get a list of {content-type} entries |
| GET | [/{content-type}/:id](#get-restaurants-id) | Get a specific {content-type} entry |
| GET | [/{content-type}/count](#get-restaurants-count) | Count {content-type} entries |
| POST | [/{content-type}](#post-restaurants) | Create a {content-type} entry |
| GET | [/{content-type}/:id](#get-restaurants-id) | Get a specific {content-type} entry |
| DELETE | [/{content-type}/:id](#delete-restaurants-id) | Delete a {content-type} entry |
| PUT | [/{content-type}/:id](#put-restaurants-id) | Update a {content-type} entry |
@ -87,9 +87,9 @@ Here is the list of endpoints generated for each of your **Content Types**
| Method | Path | Description |
| :----- | :----------------- | :------------------------ |
| GET | /restaurants | Get a list of restaurants |
| GET | /restaurants/:id | Get a specific restaurant |
| GET | /restaurants/count | Count restaurants |
| POST | /restaurants | Create a restaurant |
| GET | /restaurants/:id | Get a specific restaurant |
| DELETE | /restaurants/:id | Delete a restaurant |
| PUT | /restaurants/:id | Update a restaurant |
@ -106,9 +106,9 @@ Here is the list of endpoints generated for each of your **Content Types**
| Method | Path | Description |
| :----- | :-------------- | :--------------------- |
| GET | /articles | Get a list of articles |
| GET | /articles/:id | Get a specific article |
| GET | /articles/count | Count articles |
| POST | /articles | Create a article |
| GET | /articles/:id | Get a specific article |
| DELETE | /articles/:id | Delete a article |
| PUT | /articles/:id | Update a article |
@ -125,9 +125,9 @@ Here is the list of endpoints generated for each of your **Content Types**
| Method | Path | Description |
| :----- | :-------------- | :--------------------- |
| GET | /products | Get a list of products |
| GET | /products/:id | Get a specific product |
| GET | /products/count | Count products |
| POST | /products | Create a product |
| GET | /products/:id | Get a specific product |
| DELETE | /products/:id | Delete a product |
| PUT | /products/:id | Update a product |
@ -144,9 +144,9 @@ Here is the list of endpoints generated for each of your **Content Types**
| Method | Path | Description |
| :----- | :---------------- | :----------------------- |
| GET | /categories | Get a list of categories |
| GET | /categories/:id | Get a specific category |
| GET | /categories/count | Count categories |
| POST | /categories | Create a category |
| GET | /categories/:id | Get a specific category |
| DELETE | /categories/:id | Delete a category |
| PUT | /categories/:id | Update a category |
@ -163,9 +163,9 @@ Here is the list of endpoints generated for each of your **Content Types**
| Method | Path | Description |
| :----- | :---------- | :----------------- |
| GET | /tags | Get a list of tags |
| GET | /tags/:id | Get a specific tag |
| GET | /tags/count | Count tags |
| POST | /tags | Create a tag |
| GET | /tags/:id | Get a specific tag |
| DELETE | /tags/:id | Delete a tag |
| PUT | /tags/:id | Update a tag |
@ -210,6 +210,38 @@ GET http://localhost:1337/restaurants
]
```
## Get an entry
Returns an entry by id.
**Example request**
```js
GET http://localhost:1337/restaurants/1
```
**Example response**
```json
{
"id": 1,
"title": "Restaurant 1",
"cover": {
"id": 1,
"url": "/uploads/3d89ba92f762433bbb75bbbfd9c13974.png"
//...
},
"opening_hours": [
{
"id": 1,
"day_interval": "Tue - Sat",
"opening_hour": "7:30 PM",
"closing_hour": "10:00 PM"
}
]
}
```
## Count entries
Returns the count of entries matching the query filters. You can read more about parameters [here](./parameters.md).
@ -272,38 +304,6 @@ POST http://localhost:1337/restaurants
}
```
## Get an entry
Returns an entry by id.
**Example request**
```js
GET http://localhost:1337/restaurants/1
```
**Example response**
```json
{
"id": 1,
"title": "Restaurant 1",
"cover": {
"id": 1,
"url": "/uploads/3d89ba92f762433bbb75bbbfd9c13974.png"
//...
},
"opening_hours": [
{
"id": 1,
"day_interval": "Tue - Sat",
"opening_hour": "7:30 PM",
"closing_hour": "10:00 PM"
}
]
}
```
## Update an entry
Partially updates an entry by id and returns its value.

View File

@ -55,6 +55,14 @@ If you use the same operator (except for in and nin) the values will be used to
`GET /restaurants?name_contains=pizza&name_contains=giovanni`
::: warning
If you want to use `AND` for your query you will have to create a custom query by using the [Query](../concepts/query.md) documentation.
Strapi doesn't support the `AND` opperator for now.
:::
## Deep filtering
Find restaurants owned by a chef who belongs to a restaurant with star equal to 5

View File

@ -1,127 +1,27 @@
# Installation Requirements
# Installation requirements
This page covers installing the basic requirements for Strapi.
## Basic Installation Requirements
## Node.js
Strapi only requires [Node.js](https://nodejs.org). The current recommended version to run strapi is `Node v10` (current `LTS`).
This is all that is needed before Strapi can run on your local environment.
## Installing Node.js
You can also use **yarn** if you want [here](https://yarnpkg.com/en/docs/getting-started) are the instructions to get started with it.
You can install `Node.js` and `npm` for `Windows 10`, `Ubuntu 18.04` and `Mac O/S Mojave` with the following instructions.
- **Node.js** >= 10.x
- **NPM** >= 6.x
#### Installation Instructions for each Operating System:
## Databases
:::: tabs
Strapi is supporting multiple databases. If you are using the `--quickstart` or if you manually chose the `SQLite` database, you will not need to install any database on you local computer.
::: tab "Windows 10"
If you want to use a custom database, here is versions you will have to respect:
### Installing Node.js on Windows 10
There are several methods to install Node.js on _Windows 10_.
We will follow the most common download and installation procedure. These _instructions are for Windows 10_. (If you are installing on a different version of Windows or if you have trouble following these instructions, please review the [official Node.js documentation](https://nodejs.org/en/docs/).)
1. Download the Windows Installer from the [downloads page](https://nodejs.org/en/download/). You will need to choose the 32-bit or 64-bit version. We recommend the LTS (long-term support) version of Node.js.
2. Double-click the node-v10.x.x-x86.msi file icon. Click "Next" for the default options and to install Node.js under the recommended and most common settings. After clicking "Next" several times, click "Install" to install Node.js. When it is done installing, click "Finish".
3. Verify both Node.js and npm have installed correctly. Open your Command Prompt:
- Click your Start Button
- In Search type, "cmd"
- Then click on "Command Prompt".
- Type the following commands in your Command Prompt
Verify Node.js has correctly installed:
```shell
node -v
## You should see "v10.x.x
```
Next, verify npm has correctly installed:
```shell
npm -v
## You should see "6.x.x"
```
:::
::: tab "Mac O/S"
### Installing Node.js on Mac O/S X (Mojave)
There are multiple methods to install Node.js on _Mac O/S X (Mojave)_.
We will follow the most common download and installation procedure. _These instructions are for Mac O/S X (Mojave)_. (If you are installing on a different version of Mac O/S or if you have trouble following these instructions, please review the [official Node.js documentation](https://nodejs.org/en/docs/).)
1. Download the Mac O/S Installer from the [downloads page](https://nodejs.org/en/download/). We recommend the LTS (long-term support) version of Node.js.
2. Launch the node-v10.x.x.pkg file icon. Click "Continue" for the default options and to install Node.js under the recommended and most common settings. After clicking "Continue" several times, click "Install" to install Node.js. When it is done installing, click "Close".
3. Verify both Node.js and npm have installed correctly. Open your terminal prompt:
- Open your Applications folder
- Find and open the Utilities folder
- Find "Terminal" and click on it to open it.
- Type the following commands in your Terminal
Verify Node.js has correctly installed:
```terminal
node -v
## You should see "v10.x.x"
```
Next, verify npm has correctly installed:
```terminal
npm -v
## You should see "6.x.x"
```
:::
::: tab "UBUNTU 18.04"
### Installing Node.js on Ubuntu 18.04
There are multiple methods to install Node.js on _Ubuntu 18.04_.
We will follow the most common download and installation procedure. _These instructions are for Ubuntu 18.04_. (If you are installing on a different version of Ubuntu or a different Linux Distro or if you have trouble following these instructions, please review the [official Node.js documentation](https://nodejs.org/en/docs/).)
1. Install cURL and use cURL to download the Node.js (with npm) source code
```bash
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
```
2. Install Node.js (with npm) and install `build-essential` package:
```bash
sudo apt-get install -y nodejs
sudo apt install build-essential
```
Verify Node.js has correctly installed:
```bash
node -v
## You should see "v10.x.x"
```
Next, verify npm has correctly installed:
```bash
npm -v
## You should see "6.x.x"
```
:::
::::
### Using Yarn
You can also use yarn if you want [here](https://yarnpkg.com/en/docs/getting-started) are the instructions to get started with it.
- **MongoDB** >= 3.6
- **MySQL** >= 5.6
- **MariaDB** >= 10.1
- **PostgreSQL** >= 10
- **SQLite** >= 3
::: tip NEXT STEPS
👏 Congrats, you are all set! Now that Node.js is installed you can continue with the [Quick start guide](quick-start.md).

View File

@ -10,7 +10,7 @@ By following this tutorial, you install and create your first Strapi project.
::: tip NOTE
You need to have **_Node.js and npm_** installed on your system before following these steps. If you do not have Node.js and npm installed (or are not sure), please visit our [Installation Requirements](install-requirements.md).
You need to have **_Node.js and npm_** installed on your system before following these steps. If you do not have Node.js and npm installed (or are not sure), please visit our [installation requirements](install-requirements.md).
:::
@ -20,31 +20,41 @@ You need to have **_Node.js and npm_** installed on your system before following
## 1. Install Strapi and create a project
- Navigate to your parent `Projects/` directory from your command line.
Navigate to your parent `Projects/` directory from your command line.
**Note:** In this tutorial, the example assumes a **Projects** folder on your **Desktop**. However, this is not required, and you may put your project where you want.
::: tip NOTE
Path: `~/Desktop/Projects/`
In this tutorial, the example assumes a **Projects** folder on your **Desktop**. However, this is not required, and you may put your project where you want.
Use **only one** of the following commands to create a new Strapi project:
:::
---
**Path —** `~/Desktop/Projects/`
- Use **yarn** to install the Strapi project (**recommended**). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/)
Use **only one** of the following commands to create a new Strapi project
:::: tabs
::: tab yarn
Use **yarn** to install the Strapi project (**recommended**). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/)
```bash
yarn create strapi-app my-project --quickstart
```
**or**
:::
- Use **npm/npx** to install the Strapi project
::: tab npx
Use **npm/npx** to install the Strapi project
```bash
npx create-strapi-app my-project --quickstart
```
---
:::
::::
The command creates a Strapi project `my-project/` folder within your parent `Projects/` directory.
@ -52,9 +62,6 @@ The command creates a Strapi project `my-project/` folder within your parent `Pr
When you create a new Quick Start(`--quickstart`) project, Strapi downloads the node modules and the Strapi files needed. Using `--quickstart` automatically completes an **additional** step of **building the administration panel** for Strapi and then **starting** Strapi for you. This opens the browser for you and brings you to the [Welcome](http://localhost:1337/admin/plugins/users-permissions/auth/register) page.
:::
::: tip NOTE
You can replace the `my-project` name with any name you want. E.g., `yarn create strapi-app my-foodadvisor-project --quickstart` creates a folder `./Projects/my-foodadvisor-project`.
:::
@ -131,9 +138,7 @@ Building your admin UI with development configuration ...
::: tip NOTE
Using the `--quickstart` flag installs Strapi using an [SQLite](https://www.sqlite.org/index.html) database. You may, at any time, leave off the **--flag**, but you need to follow a few configuration steps for your database choice. **You need to have your database choice installed and running locally before creating your project.**
**Note:** An **SQLite** database is an excellent database to use for prototyping and _developing_ Strapi projects. **SQLite** is a light database that ports effortlessly to the other relational databases (**MySQL**, **PostgreSQL**, and **MariaDB**). It is recommended to **develop** with SQLite and to use another relational database (MySQL, PostgreSQL or MariaDB) in production.
**Note:** If you would like to use **MongoDB** in production, you need to [install, run, and use MongoDB to develop your Strapi project (in development)](../guides/databases.md#mongodb-installation).
If you would like to use **MongoDB** in production, you need to [install, run, and use MongoDB to develop your Strapi project (in development)](../guides/databases.md#mongodb-installation).
:::
You are now ready to create a new **Administrator** and new front-end **User**.
@ -164,7 +169,11 @@ After your **Administrator** registration is complete, you see the Strapi _Admin
Up until this point, you have created an **Administrator**, and so you next want to create a front-end **User**.
**Note:** It is not necessary to always create a front-end **User** for your **Administrators**; in this case, the **Administrator** is also a front-end **User** as an "Author" of content in the application.
::: tip NOTE
It is not necessary to always create a front-end **User** for your **Administrators**; in this case, the **Administrator** is also a front-end **User** as an "Author" of content in the application.
:::
- Click on `Users` located under **CONTENT TYPES** in the left-hand menu
- Click the blue **+ Add New User** button in the top right corner
@ -193,7 +202,7 @@ Additional **Restaurant** themed **Content Types** and fields can be seen in the
### The Restaurant Content Type
- Go to the **Content Type Builder** plugin, located in the left menu: Under **PLUGINS**: --> **Content Type Builder**
Go to the **Content Type Builder** plugin, located in the left menu: Under **PLUGINS** -> **Content Type Builder**
You are now able to see the three available **Content Types**. At this point, three Content Types are available `Permission`, `Role`, and `Users`.
@ -201,7 +210,7 @@ You are now able to see the three available **Content Types**. At this point, th
You need to create a new **Content Type** for `Restaurants`.
1. Complete these steps to **Add a Restaurant Content Type**:
1. Complete these steps to **Add a Restaurant Content Type**
- Click the `+ Add A Content Type` link (under existing **CONTENT TYPES**)
- Enter a **Name** for your new **Content Type** (call this `restaurant`), and you can write `Restaurant Listings` for the **Description**
@ -215,7 +224,7 @@ The Content Type **Name** is always **singular**. For example, `restaurant` not
:::
2. You are now at the **Field Selection** panel:
2. You are now at the **Field Selection** panel
You may add your first field, a **String** field for the **Restaurant** name.
@ -402,7 +411,11 @@ You are now ready to add a third field, another **String** field for the **Closi
After Strapi has restarted, you are ready to assign this **Hours_of_operation** group to the **Restaurant** Content Type.
**Note:** It would be possible to assign the **Hours_of_operation** group to another **Content Type**, let's say, a **Cafe** Content Type. You have the option to reuse this group across your application.
::: tip NOTE
It would be possible to assign the **Hours_of_operation** group to another **Content Type**, let's say, a **Cafe** Content Type. You have the option to reuse this group across your application.
:::
3. Next, you need to assign the **Hours_of_operation** Group to the **Restaurant** Content Type.

View File

@ -12,18 +12,26 @@ _For a step-by-step guide, please take a look at the [detailed tutorial](quick-s
## 1. Install Strapi and Create a new project
:::: tabs
::: tab yarn
```bash
yarn create strapi-app my-project --quickstart
```
**or**
:::
- Use **npm/npx** to install the Strapi project.
::: tab npx
```bash
npx create-strapi-app my-project --quickstart
```
:::
::::
## 2. Create an Administrator user
Navigate to [**http://localhost:1337/admin**](http://localhost:1337/admin).