diff --git a/docs/.vuepress/theme/SidebarLink.vue b/docs/.vuepress/theme/SidebarLink.vue
index 6aaef95188..7a10d3f1c8 100644
--- a/docs/.vuepress/theme/SidebarLink.vue
+++ b/docs/.vuepress/theme/SidebarLink.vue
@@ -5,8 +5,8 @@ import AppLink from './AppLink'
export default {
functional: true,
components: {AppLink},
- props: ['item'],
- render (h, { parent: { $page, $site, $route }, props: { item }}) {
+ props: ['item', 'open', 'collapsable'],
+ render (h, { parent: { $page, $site, $route }, props: { item, open, collapsable }}) {
// use custom active class matching logic
// due to edge case of paths ending with / + hash
const selfActive = isActive($route, item.path)
@@ -15,7 +15,8 @@ export default {
const active = item.type === 'auto'
? selfActive || item.children.some(c => isActive($route, item.basePath + '#' + c.slug))
: selfActive
- const link = renderLink(h, item.path, item.title || item.path, active)
+ const hidden = $site.themeConfig.hiddenLinks.includes(item.path);
+ const link = renderLink(h, item.path, item.title || item.path, active, hidden)
const configDepth = $page.frontmatter.sidebarDepth != null
? $page.frontmatter.sidebarDepth
: $site.themeConfig.sidebarDepth
@@ -25,13 +26,16 @@ export default {
} else if (active && item.headers && !hashRE.test(item.path)) {
const children = groupHeaders(item.headers)
return [link, renderChildren(h, children, item.path, $route, maxDepth)]
+ } else if (collapsable && open && hidden && !active && item.headers && !hashRE.test(item.path)) {
+ const children = groupHeaders(item.headers)
+ return [link, renderChildren(h, children, item.path, $route, maxDepth)]
} else {
return link
}
}
}
-function renderLink (h, to, text, active) {
+function renderLink (h, to, text, active, hidden) {
if (~to.indexOf('http')) return h('a',
{
attrs: {
@@ -48,6 +52,7 @@ function renderLink (h, to, text, active) {
},
class: {
active,
+ hidden,
'sidebar-link': true
}
}, text)
@@ -58,7 +63,7 @@ function renderChildren (h, children, path, route, maxDepth, depth = 1) {
return h('ul', { class: 'sidebar-sub-headers' }, children.map(c => {
const active = isActive(route, path + '#' + c.slug)
return h('li', { class: 'sidebar-sub-header' }, [
- renderLink(h, '#' + c.slug, c.title, active),
+ renderLink(h, path + '#' + c.slug, c.title, active),
renderChildren(h, c.children, path, route, maxDepth, depth + 1)
])
}))
@@ -87,6 +92,8 @@ a.sidebar-link
font-weight 600
color $accentColor
border-left-color $accentColor
+ &.hidden
+ display: none
.sidebar-group &
padding-left 2rem
.sidebar-sub-headers &
diff --git a/docs/.vuepress/theme/styles/config.styl b/docs/.vuepress/theme/styles/config.styl
index d7db7a3ad1..984cb568c2 100644
--- a/docs/.vuepress/theme/styles/config.styl
+++ b/docs/.vuepress/theme/styles/config.styl
@@ -8,7 +8,7 @@ $arrowBgColor = #ccc
// layout
$navbarHeight = 3.6rem
$sidebarWidth = 20rem
-$contentWidth = 740px
+$contentWidth = 800px
// responsive breakpoints
$MQNarrow = 959px
diff --git a/docs/.vuepress/theme/styles/theme.styl b/docs/.vuepress/theme/styles/theme.styl
index c3165711a4..5a02a27b30 100644
--- a/docs/.vuepress/theme/styles/theme.styl
+++ b/docs/.vuepress/theme/styles/theme.styl
@@ -27,9 +27,8 @@ a img + svg
display none !important
.version-selector
- margin 1em 1em 0 1.5em
+ margin-left 1.5rem
color lighten($textColor, 25%)
- display block
border 1px solid darken($borderColor, 10%)
font-size .9rem
line-height 2rem
diff --git a/docs/3.x.x/assets/getting-started_add_entry-.png b/docs/3.x.x/assets/getting-started_add_entry-.png
new file mode 100644
index 0000000000..8ec9a50042
Binary files /dev/null and b/docs/3.x.x/assets/getting-started_add_entry-.png differ
diff --git a/docs/3.x.x/assets/getting-started_add_entry.png b/docs/3.x.x/assets/getting-started_add_entry.png
index 3641893a2d..ec80aa960c 100644
Binary files a/docs/3.x.x/assets/getting-started_add_entry.png and b/docs/3.x.x/assets/getting-started_add_entry.png differ
diff --git a/docs/3.x.x/assets/getting-started_allow_access.png b/docs/3.x.x/assets/getting-started_allow_access.png
index 3c87f056b0..97e5d41cfe 100644
Binary files a/docs/3.x.x/assets/getting-started_allow_access.png and b/docs/3.x.x/assets/getting-started_allow_access.png differ
diff --git a/docs/3.x.x/assets/getting-started_create_content_type.png b/docs/3.x.x/assets/getting-started_create_content_type.png
index 01bcb17035..d94c0a1406 100644
Binary files a/docs/3.x.x/assets/getting-started_create_content_type.png and b/docs/3.x.x/assets/getting-started_create_content_type.png differ
diff --git a/docs/3.x.x/assets/getting-started_list_fields.png b/docs/3.x.x/assets/getting-started_list_fields.png
index eda037d52e..c26747f756 100644
Binary files a/docs/3.x.x/assets/getting-started_list_fields.png and b/docs/3.x.x/assets/getting-started_list_fields.png differ
diff --git a/docs/3.x.x/assets/getting-started_manage_role_home.png b/docs/3.x.x/assets/getting-started_manage_role_home.png
index 30844f5da0..ddd46bce6a 100644
Binary files a/docs/3.x.x/assets/getting-started_manage_role_home.png and b/docs/3.x.x/assets/getting-started_manage_role_home.png differ
diff --git a/docs/3.x.x/assets/getting-started_no_content_type.png b/docs/3.x.x/assets/getting-started_no_content_type.png
index 4df862022e..0823076f16 100644
Binary files a/docs/3.x.x/assets/getting-started_no_content_type.png and b/docs/3.x.x/assets/getting-started_no_content_type.png differ
diff --git a/docs/3.x.x/assets/getting-started_no_entry.png b/docs/3.x.x/assets/getting-started_no_entry.png
index dfaae83f68..4c35bdfc56 100644
Binary files a/docs/3.x.x/assets/getting-started_no_entry.png and b/docs/3.x.x/assets/getting-started_no_entry.png differ
diff --git a/docs/3.x.x/assets/getting-started_no_entry_.png b/docs/3.x.x/assets/getting-started_no_entry_.png
new file mode 100644
index 0000000000..f632444be0
Binary files /dev/null and b/docs/3.x.x/assets/getting-started_no_entry_.png differ
diff --git a/docs/3.x.x/assets/getting-started_with_entry.png b/docs/3.x.x/assets/getting-started_with_entry.png
index 0f51766cfa..14685eae90 100644
Binary files a/docs/3.x.x/assets/getting-started_with_entry.png and b/docs/3.x.x/assets/getting-started_with_entry.png differ
diff --git a/docs/3.x.x/assets/getting-started_with_entry_.png b/docs/3.x.x/assets/getting-started_with_entry_.png
new file mode 100644
index 0000000000..0f51766cfa
Binary files /dev/null and b/docs/3.x.x/assets/getting-started_with_entry_.png differ
diff --git a/docs/3.x.x/assets/terminal_new.png b/docs/3.x.x/assets/terminal_new.png
index 0ea2c51cdd..7408c81fb4 100644
Binary files a/docs/3.x.x/assets/terminal_new.png and b/docs/3.x.x/assets/terminal_new.png differ
diff --git a/docs/3.x.x/assets/terminal_start.png b/docs/3.x.x/assets/terminal_start.png
index 8e0e575e01..9fee7bc023 100644
Binary files a/docs/3.x.x/assets/terminal_start.png and b/docs/3.x.x/assets/terminal_start.png differ
diff --git a/docs/3.x.x/getting-started/installation.md b/docs/3.x.x/getting-started/installation.md
index 7df07739e3..178d63f486 100644
--- a/docs/3.x.x/getting-started/installation.md
+++ b/docs/3.x.x/getting-started/installation.md
@@ -1,6 +1,8 @@
# Installation
-Installation is very easy and only takes a few seconds.
+### 👋 Welcome onboard!
+
+You recently discovered Strapi and look forward to give it a try? Let's start with the installation!
## Requirements
@@ -8,10 +10,11 @@ Please make sure your computer/server meets the following requirements:
- [Node.js](https://nodejs.org) >= 10.x: Node.js is a server platform which runs JavaScript. Installation guide [here](https://nodejs.org/en/download/).
- [NPM](https://www.npmjs.com/) >= 6.x: NPM is the package manager for Javascript. Installation guide [here](https://nodejs.org/en/download/).
*(Make sure the database that you are using meets the requirement.)*
- - [MongoDB](https://www.mongodb.com/) >= 3.x: MongoDB is a powerful document store. Installation guide [here](https://www.mongodb.com/download-center?j#community).
- - [MySQL](https://www.mysql.com/) >= 5.6: MySQL is an open-source relational database management system. Installation guide [here](https://dev.mysql.com/downloads/).
- - [MariaDB](https://mariadb.org/) >= 10.1: MarialDB is a fork of MySQL and is guaranteed to stay open source. Installation guide [here](https://mariadb.org/download/).
- - [PostgreSQL](https://www.postgresql.org/) >= 10: PostgreSQL is an open-source object-relational database management system. Installation guide [here](https://www.postgresql.org/download/).
+ - The database of your choice:
+ - [MongoDB](https://www.mongodb.com/) >= 3.x: MongoDB is a powerful document store. Installation guide [here](https://www.mongodb.com/download-center?j#community).
+ - [MySQL](https://www.mysql.com/) >= 5.6: MySQL is an open-source relational database management system. Installation guide [here](https://dev.mysql.com/downloads/).
+ - [MariaDB](https://mariadb.org/) >= 10.1: MarialDB is a fork of MySQL and is guaranteed to stay open source. Installation guide [here](https://mariadb.org/download/).
+ - [PostgreSQL](https://www.postgresql.org/) >= 10: PostgreSQL is an open-source object-relational database management system. Installation guide [here](https://www.postgresql.org/download/).
## Setup
@@ -27,7 +30,7 @@ If you encounter npm permissions issues, [change the permissions to npm default
It takes about 20 seconds with a good Internet connection. You can take a coffee ☕️ if you have a slow one.
-Having troubles during the installation? Check if someone already had the same issue https://github.com/strapi/strapi/issues. If not, you can [post one](https://github.com/strapi/strapi/issues/new), or ask for help https://strapi.io/support.
+Having troubles during the installation? Check if someone already had the [same issue](https://github.com/strapi/strapi/issues). If not, please [post one](https://github.com/strapi/strapi/issues/new).
## Check installation
@@ -43,4 +46,4 @@ Strapi is installed globally on your computer. Type `strapi` in your terminal yo
***
-Congrats! Now that Strapi is installed you can [create your first API](quick-start.md).
+👏 Congrats, you are all set! Now that Strapi is installed you can [create your first project](quick-start.md).
diff --git a/docs/3.x.x/getting-started/quick-start.md b/docs/3.x.x/getting-started/quick-start.md
index 45604f31cd..ea51a73f94 100644
--- a/docs/3.x.x/getting-started/quick-start.md
+++ b/docs/3.x.x/getting-started/quick-start.md
@@ -3,22 +3,21 @@
This section explains how to handle Strapi for the first time, ([check out our tutorial video](https://www.youtube.com/watch?v=yMl5IcFHA74)).
**Table of contents:**
-- [Quick start](#quick-start)
- - [Create your first project](#create-your-first-project)
- - [Create your first user](#create-your-first-user)
- - [Create your first API](#create-your-first-api)
- - [Files structure](#files-structure)
- - [Manage your data](#manage-your-data)
- - [Consume your API](#consume-your-api)
- - [List entries (GET)](#list-entries-get)
- - [Get a specific entry (GET)](#get-a-specific-entry-get)
- - [Create data (POST)](#create-data-post)
- - [Update data (PUT)](#update-data-put)
- - [Delete data (DELETE)](#delete-data-delete)
+- [1. Create your first project](#_1-create-a-project)
+- [2. Create your first user](#_2-register-the-first-user)
+- [3. Create your first Content Type](#_3-create-a-content-type)
+ - [Files structure](#files-structure)
+- [4. Manage your data](#_4-add-content)
+- [5. Consume your API](#_5-consume-the-api)
+ - [List entries (GET)](#list-entries-get)
+ - [Get a specific entry (GET)](#get-a-specific-entry-get)
+ - [Create data (POST)](#create-data-post)
+ - [Update data (PUT)](#update-data-put)
+ - [Delete data (DELETE)](#delete-data-delete)
***
-## Create your first project
+## 1. Create a project
Creating your first project with Strapi is easy:
@@ -34,6 +33,10 @@ strapi new my-project

+::: note
+The CLI will ask you to choose your database: select MongoDB, Postgres or MySQL. Then, fill the database information in. The default values should work if you correctly installed the database system on your machine.
+:::
+
This action creates a new folder named `my-project` with the entire [files structure](../concepts/concepts.md#files-structure) of a Strapi application.
**#3 — Go to your project and launch the server:**
@@ -47,44 +50,42 @@ strapi start

-Now that your app is running let's see how to [create your first user](#create-your-first-user).
+Now that your app is running let's see how to [create your first user](#_2-register-the-first-user).
***
-## Create your first user
+## 2. Register the first user
-In order to use the admin panel and to consume your API you first need to register your first user. This process only happens once if you don't have any user table created and is made to create the `admin user` that has all the permissions granted for your API.
+In order to use the admin panel and to consume your API you first need to register your first user. This process only happens once and is made to create the `admin user` who has all the permissions granted.
-If you're using MongoDB for your database you don't have to create your table manually (it's already handled by Strapi) otherwise you'll have to create your user table first.
-
-To create your first user, start your server (`strapi start`) and go to : http://localhost:1337/admin.
+To create your first user, start your server (`strapi start`) and go to [http://localhost:1337/admin](http://localhost:1337/admin).

-Now that your first user is registered let's see how to [create your first api](#create-your-first-api).
+Now that your first user is registered let's see how to [create your first Content Type](#_3-create-a-content-type).
+
***
-## Create your first API
-To create your first API, start your server (`strapi start`) and go to : http://localhost:1337/admin.
+## 3. Create a Content Type
-At this point, your application is empty. To create your first API is to use the **Content Type Builder** plugin: a powerful UI to help you create an API in a few clicks. Let's take the example of an e-commerce API, which manages products.
+At this point, your project is empty. To create your first Content Type, you are going to use the **Content Type Builder** plugin: a powerful UI to help defining your Content Type's structure within a few clicks. Let's take the example of blog, which manages posts.
**#1 —** Go to the **Content Type Builder** plugin.

-**#2 —** Create a Content Type named `Product` and submit the form.
+**#2 —** Create a Content Type named `Post` and submit the form.

**#3 —** Add three fields in this Content Type.
- - A `string` field named `name`.
- - A `text` field named `description`.
- - A `number` field named `price` (with `float` as number format).
+ - A `string` field named `title`.
+ - A `text` field named `content` (tick the `Display as WYSIWYG` in the `Advanced Settings` tab).
+ - A `media` field named `cover`.
-
+
**#4 —** Save. That's it!
@@ -95,22 +96,22 @@ See the [CLI documentation](../cli/CLI.md#strapi-generateapi) for more informati
### Files structure
-A new directory has been created in the `./api` folder of your application which contains all the needed stuff for your `Product` Content Type: routes, controllers, services and models. Take a look at the [API structure documentation](../concepts/concepts.md#files-structure) for more informations.
+A new directory has been created in the `./api` folder of your application which contains all the needed stuff for your `Post` Content Type: routes, controllers, services and models. Take a look at the [API structure documentation](../concepts/concepts.md#files-structure) for more informations.
-**Well done, you created your first API using Strapi!**
+**Well done, you created your first Content Type using Strapi!**
***
-## Manage your data
+## 4. Add content
-After creating [your first Content Type](#create-your-first-api), it would be great to be able to create, edit or delete entries.
+After creating [your first Content Type](#_3-create-a-content-type), you probably want to create, edit or delete entries. No worries, everything is ready for you:
-**#1 —** Go to the [**Product list**](http://localhost:1337/admin/plugins/content-manager/product/) by clicking on the link in the left menu (generated by the **Content Manager** plugin).
+**#1 —** Go to the [**Post list**](http://localhost:1337/admin/plugins/content-manager/post/) by clicking on the link in the left menu (generated by the **Content Manager** plugin).

-**#2 —** Click on the button `Add New Product` and fill the form.
+**#2 —** Click on the button `Add New Post` and fill the form.

@@ -120,125 +121,161 @@ After creating [your first Content Type](#create-your-first-api), it would be gr
***
-## Consume your API
+## 5. Consume the API
-Your API is now ready and [contains data](#manage-your-data). At this point, you'll probably want to use this data in mobile or desktop applications.
-In order to do so, you'll need to allow access to other users (identified as 'Guest').
+Your API is now ready and [contains data](#_4-add-content). At this point, you'll probably want to use this data in mobile or desktop applications.
+In order to do so, you'll need to allow access to other users (identified as 'Public').
-**1 -** Go to the [**Auth & Permissions View**](http://localhost:1337/admin/plugins/users-permissions/roles) by clicking on **Auth & Permissions** link in the left menu and click on the **Guest Role** item.
+**1 -** Go to the [**Auth & Permissions View**](http://localhost:1337/admin/plugins/users-permissions/roles) by clicking on **Auth & Permissions** link in the left menu.

-**2 -** Manage your APIs permissions in the **Permissions** section of the [**Edit Guest Role view**](http://localhost:1337/admin/plugins/users-permissions/roles/edit/1) by enabling or disabling specific actions.
+**2 -** Click on the `Public` role, enable the actions related to your new Content Type and save:
-
+
+::: note
+You should now be able to get the list of posts from the API: [http://localhost:1337/posts](http://localhost:1337/posts).
+:::
### List entries (GET)
-To retrieve the list of products, use the `GET /products` route.
+To retrieve the list of posts, use the `GET /posts` route.
-Generated APIs provide a handy way to filter and order queries. In that way, ordering products by price is as easy as `GET http://localhost:1337/products?_sort=price:asc`. For more informations, read the [filters documentation](../guides/filters.md)
+Generated APIs provide a handy way to filter and order queries. In that way, ordering posts by price is as easy as `GET http://localhost:1337/posts?_sort=price:asc`. For more informations, read the [filters documentation](../guides/filters.md).
-Here is an example using jQuery.
+Here is an example using Axios:
```js
-$.ajax({
- type: 'GET',
- url: 'http://localhost:1337/products?_sort=price:asc', // Order by price.
- done: function(products) {
- console.log('Well done, here is the list of products: ', products);
- },
- fail: function(error) {
+import axios from 'axios';
+
+// Request API.
+axios
+ .get('http://localhost:1337/posts', {
+ params: {
+ _sort: 'createdAt:desc' // Generates http://localhost:1337/posts?_sort=createdAt:desc
+ }
+ })
+ .then(response => {
+ // Handle success.
+ console.log('Well done, here is the list of posts: ', response.data);
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
### Get a specific entry (GET)
-If you want to get a specific entry, add the `id` of the wanted product at the end of the url.
+If you want to get a specific entry, add the `id` of the wanted post at the end of the url.
+
+Examble with Axios:
```js
-$.ajax({
- type: 'GET',
- url: 'http://localhost:1337/products/123', // Where `123` is the `id` of the product.
- done: function(product) {
- console.log('Well done, here is the product having the `id` 123: ', product);
- },
- fail: function(error) {
+import axios from 'axios';
+
+const postId = 'YOUR_POST_ID_HERE'; // Replace with one of your posts id.
+
+// Request API.
+axios
+ .get(`http://localhost:1337/posts/${postId}`)
+ .then(response => {
+ // Handle success.
+ console.log('Well done, here is the post: ', response.data);
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
### Create data (POST)
Use the `POST` route to create a new entry.
-jQuery example:
+Examble with Axios:
```js
-$.ajax({
- type: 'POST',
- url: 'http://localhost:1337/products',
- data: {
- name: 'Cheese cake',
- description: 'Chocolate cheese cake with ice cream',
- price: 5
- },
- done: function(product) {
- console.log('Congrats, your product has been successfully created: ', product); // Remember the product `id` for the next steps.
- },
- fail: function(error) {
+import axios from 'axios';
+
+// Request API.
+axios
+ .post(`http://localhost:1337/posts/`, {
+ title: 'My new post'
+ })
+ .then(response => {
+ // Handle success.
+ console.log(
+ 'Well done, your post has been successfully created: ',
+ response.data
+ );
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
### Update data (PUT)
Use the `PUT` route to update an existing entry.
-jQuery example:
+Examble with Axios:
```js
-$.ajax({
- type: 'PUT',
- url: 'http://localhost:1337/products/123', // Where `123` is the `id` of the product.
- data: {
- description: 'This is the new description'
- },
- done: function(product) {
- console.log('Congrats, your product has been successfully updated: ', product.description);
- },
- fail: function(error) {
+import axios from 'axios';
+
+const postId = 'YOUR_POST_ID_HERE'; // Replace with one of your posts id.
+
+// Request API.
+axios
+ .put(`http://localhost:1337/posts/${postId}`, {
+ title: 'Updated title'
+ })
+ .then(response => {
+ // Handle success.
+ console.log(
+ 'Well done, your post has been successfully updated: ',
+ response.data
+ );
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
### Delete data (DELETE)
Use the `DELETE` route to delete an existing entry.
-jQuery example:
+Examble with Axios:
```js
-$.ajax({
- type: 'DELETE',
- url: 'http://localhost:1337/products/123', // Where `123` is the `id` of the product.
- done: function(product) {
- console.log('Congrats, your product has been successfully deleted: ', product);
- },
- fail: function(error) {
- console.log('An error occurred:', error);
- }
-});
-```
+import axios from 'axios';
+const postId = 'YOUR_POST_ID_HERE'; // Replace with one of your posts id.
+
+// Request API.
+axios
+ .delete(`http://localhost:1337/posts/${postId}`)
+ .then(response => {
+ // Handle success.
+ console.log(
+ 'Well done, your post has been successfully updated: ',
+ response.data
+ );
+ })
+ .catch(error => {
+ // Handle error.
+ console.log('An error occurred:', error);
+ });
+```
***
-Congratulations! You successfully finished the Getting Started guide! Read the [concepts](../concepts/concepts.md) to understand more advanced concepts.
+#### 👏 Congratulations!
+
+You successfully finished the Getting Started guide! Read the [concepts section](../concepts/concepts.md) to understand more deeply how to use and customize Strapi.
Also, feel free to join the community thanks to the different channels listed in the [community page](http://strapi.io/community): team members, contributors and developers will be happy to help you.
diff --git a/docs/3.x.x/guides/authentication.md b/docs/3.x.x/guides/authentication.md
index 9d73e600f5..cc956add90 100644
--- a/docs/3.x.x/guides/authentication.md
+++ b/docs/3.x.x/guides/authentication.md
@@ -4,33 +4,35 @@
This feature requires the Users & Permissions plugin (installed by default).
:::
-## Register a new user
+## Registration
This route lets you create new users.
#### Usage
```js
-$.ajax({
- type: 'POST',
- url: 'http://localhost:1337/auth/local/register',
- data: {
+import axios from 'axios';
+
+// Request API.
+axios
+ .post('http://localhost:1337/auth/local/register', {
username: 'Strapi user',
email: 'user@strapi.io',
password: 'strapiPassword'
- },
- done: function(auth) {
+ })
+ .then(response => {
+ // Handle success.
console.log('Well done!');
- console.log('User profile', auth.user);
- console.log('User token', auth.jwt);
- },
- fail: function(error) {
+ console.log('User profile', response.data.user);
+ console.log('User token', response.data.jwt);
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
-## Login.
+## Login
This route lets you login your users by getting an authentication token.
@@ -39,22 +41,24 @@ This route lets you login your users by getting an authentication token.
- The `identifier` param can either be an email or a username.
```js
-$.ajax({
- type: 'POST',
- url: 'http://localhost:1337/auth/local',
- data: {
- identifier: 'user@strapi.io',
- password: 'strapiPassword'
- },
- done: function(auth) {
+import axios from 'axios';
+
+// Request API.
+axios
+ .post('http://localhost:1337/auth/local', {
+ identifier: 'user@strapi.io',
+ password: 'strapiPassword'
+ })
+ .then(response => {
+ // Handle success.
console.log('Well done!');
- console.log('User profile', auth.user);
- console.log('User token', auth.jwt);
- },
- fail: function(error) {
+ console.log('User profile', response.data.user);
+ console.log('User token', response.data.jwt);
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
## Providers
@@ -81,14 +85,14 @@ After his approval, he will be redirected to `/auth/:provider/callback`. The `jw
Response payload:
-```js
+```json
{
"user": {},
"jwt": ""
}
```
-## Use your token to be identified as a user.
+## Token usage
By default, each API request is identified as `guest` role (see permissions of `guest`'s role in your admin dashboard). To make a request as a user, you have to set the `Authorization` token in your request headers. You receive a 401 error if you are not authorized to make this request or if your authorization header is not correct.
@@ -97,22 +101,28 @@ By default, each API request is identified as `guest` role (see permissions of `
- The `token` variable is the `data.jwt` received when login in or registering.
```js
-$.ajax({
- type: 'GET',
- url: 'http://localhost:1337/articles',
- headers: {
- Authorization: `Bearer ${token}`
- },
- done: function(data) {
- console.log('Your data', data);
- },
- fail: function(error) {
+import axios from 'axios';
+
+const token = 'YOUR_TOKEN_HERE';
+
+// Request API.
+axios
+ .get('http://localhost:1337/posts', {
+ headers: {
+ Authorization: `Bearer ${token}`
+ }
+ })
+ .then(response => {
+ // Handle success.
+ console.log('Data: ', response.data);
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
-## Send forgot password request.
+## Forgotten password
This action sends an email to a user with the link of you reset password page. This link contains an URL param `code` which is required to reset user password.
@@ -123,23 +133,25 @@ This action sends an email to a user with the link of you reset password page. T
it is used to redirect the user to the new-password form.
```js
-$.ajax({
- type: 'POST',
- url: 'http://localhost:1337/auth/forgot-password',
- data: {
+import axios from 'axios';
+
+// Request API.
+axios
+ .post('http://localhost:1337/auth/forgot-password', {
email: 'user@strapi.io',
url: 'http:/localhost:1337/admin/plugins/users-permissions/auth/reset-password'
- },
- done: function() {
+ })
+ .then(response => {
+ // Handle success.
console.log('Your user received an email');
- },
- fail: function(error) {
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
-});
+ });
```
-## Reset user password.
+## Password reset
This action will reset the user password.
@@ -148,24 +160,28 @@ This action will reset the user password.
- `code` is the url params received from the email link (see forgot password)
```js
-$.ajax({
- type: 'POST',
- url: 'http://localhost:1337/auth/reset-password',
- data: {
+import axios from 'axios';
+
+// Request API.
+axios
+ .post('http://localhost:1337/auth/reset-password', {
code: 'privateCode',
password: 'myNewPassword',
passwordConfirmation: 'myNewPassword'
- },
- done: function() {
- console.log('Your user password is reset');
- },
- fail: function(error) {
+ })
+ .then(response => {
+ // Handle success.
+ console.log('Your user\'s password has been changed.');
+ })
+ .catch(error => {
+ // Handle error.
console.log('An error occurred:', error);
- }
+ });
});
```
-## User Object In Strapi Context
+## User object in Strapi context
+
The `user` object is available to successfully authenticated requests.
#### Usage
@@ -190,7 +206,7 @@ The `user` object is available to successfully authenticated requests.
```
-## Add a new provider
+## Adding a new provider
To add a new provider on Strapi, you will need to perform changes onto the following files:
@@ -257,9 +273,9 @@ You may also want to take a look onto the numerous already made configurations [
callback(err);
} else {
// Combine username and discriminator because discord username is not unique
- var username = `${body.username}#${body.discriminator}`;
+ const username = `${body.username}#${body.discriminator}`;
callback(null, {
- username: username,
+ username,
email: body.email
});
}
@@ -322,7 +338,7 @@ As for backend, we have a `switch...case` where we need to put our new provider
Add the corresponding translation into: `packages/strapi-plugin-users-permissions/admin/src/translations/en.json`
```js
- "PopUpForm.Providers.discord.providerConfig.redirectURL": "The redirect URL to add in your Discord application configurations",
+ 'PopUpForm.Providers.discord.providerConfig.redirectURL': 'The redirect URL to add in your Discord application configurations',
````
These two change will set up the popup message who appear on the UI when we will configure our new provider.
diff --git a/docs/3.x.x/tutorials/README.md b/docs/3.x.x/tutorials/README.md
index 9b1344563d..081fcdb82d 100644
--- a/docs/3.x.x/tutorials/README.md
+++ b/docs/3.x.x/tutorials/README.md
@@ -10,7 +10,9 @@ Go further with Strapi, official and community tutorials are here to help you:
### Development
- [Building a static blog using Gatsby and Strapi (official)](https://hackernoon.com/building-a-static-blog-using-gatsby-and-strapi-8b5acfc82ad8)
-
+ - [🍝 Cooking a Deliveroo clone with Nuxt (Vue.js), GraphQL, Strapi and Stripe (official)](https://blog.strapi.io/cooking-a-deliveroo-clone-with-nuxt-vue-js-graphql-strapi-and-stripe-setup-part-1-7)
+ - [🍝 Cooking a Deliveroo clone with Next.js (React), GraphQL, Strapi and Stripe](https://blog.strapi.io/strapi-next-setup)
+
### Deployment
- [Using mLab with Strapi (official)](https://medium.com/@strapi/using-mlab-with-strapi-e3f968a9c530)
diff --git a/docs/README.md b/docs/README.md
index 0a27d4a613..6ce3067f62 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,5 +1,5 @@
---
meta:
- http-equiv: refresh
- content: 0;url=/documentation/3.x.x/
+ content: 0;url=/documentation/3.x.x/getting-started/installation.html
---
diff --git a/packages/strapi-admin/admin/src/translations/ja.json b/packages/strapi-admin/admin/src/translations/ja.json
index 2cc9b560ed..dc940acb2f 100644
--- a/packages/strapi-admin/admin/src/translations/ja.json
+++ b/packages/strapi-admin/admin/src/translations/ja.json
@@ -90,9 +90,10 @@
"app.components.listPlugins.title.plural": "{number} 個のプラグインがインストールされました",
"app.components.listPlugins.title.singular": "{number} 個のプラグインがインストールされました",
"app.components.listPluginsPage.deletePlugin.error": "アンインストール中にエラーが発生しました",
- "app.utils.SelectOption.defaultMessage": " ",
"app.utils.defaultMessage": " ",
+ "app.utils.delete": "削除",
"app.utils.placeholder.defaultMessage": " ",
+ "app.utils.SelectOption.defaultMessage": " ",
"components.AutoReloadBlocker.description": "以下のファイルを開いて、有効化してください",
"components.AutoReloadBlocker.header": "プラグインを有効化するにはリロードが必要です",
"components.ErrorBoundary.title": "なにかが間違っています...",
@@ -137,4 +138,4 @@
"notification.error": "エラーが発生しました",
"notification.error.layout": "レイアウトを復旧できませんでした",
"request.error.model.unknown": "modelが存在しません"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate-new/lib/index.js b/packages/strapi-generate-new/lib/index.js
index 7e5baa29cd..43b632008e 100644
--- a/packages/strapi-generate-new/lib/index.js
+++ b/packages/strapi-generate-new/lib/index.js
@@ -47,7 +47,7 @@ module.exports = {
// Copy Markdown files with some information.
'README.md': {
- template: 'README.md'
+ template: 'CLI.md'
},
// Empty API directory.
diff --git a/packages/strapi-hook-mongoose/lib/index.js b/packages/strapi-hook-mongoose/lib/index.js
index 3829faed44..b2cc899a6a 100644
--- a/packages/strapi-hook-mongoose/lib/index.js
+++ b/packages/strapi-hook-mongoose/lib/index.js
@@ -174,7 +174,10 @@ module.exports = function (strapi) {
_.forEach(postLifecycle, (fn, key) => {
if (_.isFunction(target[model.toLowerCase()][fn])) {
collection.schema.post(key, function (doc, next) {
- target[model.toLowerCase()][fn](this, doc).then(next).catch(err => strapi.log.error(err));
+ target[model.toLowerCase()][fn](this, doc).then(next).catch(err => {
+ strapi.log.error(err);
+ next(err);
+ });
});
}
});
diff --git a/packages/strapi-lint/lib/internals/prettier/index.js b/packages/strapi-lint/lib/internals/prettier/index.js
index b3bc9185f0..4956faaf62 100644
--- a/packages/strapi-lint/lib/internals/prettier/index.js
+++ b/packages/strapi-lint/lib/internals/prettier/index.js
@@ -16,7 +16,7 @@ const files = glob
.filter(f => changedFiles.has(f))
.filter(
package =>
- !package.includes('README.md') &&
+ !package.includes('CLI.md') &&
!package.includes('strapi-middleware-views') &&
!package.includes('strapi-lint') &&
!package.includes('strapi-plugin-settings-manager'),
diff --git a/packages/strapi-plugin-content-manager/admin/src/translations/ja.json b/packages/strapi-plugin-content-manager/admin/src/translations/ja.json
index 40c37989cf..db504a5779 100644
--- a/packages/strapi-plugin-content-manager/admin/src/translations/ja.json
+++ b/packages/strapi-plugin-content-manager/admin/src/translations/ja.json
@@ -18,7 +18,7 @@
"components.FiltersPickWrapper.PluginHeader.actions.clearAll": "すべてクリア",
"components.FiltersPickWrapper.PluginHeader.description": "エントリをフィルタリングするための条件を設定する",
"components.FiltersPickWrapper.PluginHeader.title.filter": "フィルタ",
- "components.filterspickwrapper.hide": "隠す",
+ "components.FiltersPickWrapper.hide": "隠す",
"components.LimitSelect.itemsPerPage": "ページあたりのアイテム数",
"components.Search.placeholder": "エントリを検索する...",
"components.TableDelete.delete": "すべて削除",
@@ -111,4 +111,4 @@
"popUpWarning.warning.updateAllSettings": "これにより、すべての設定が変更されます",
"success.record.delete": "削除",
"success.record.save": "保存"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-plugin-content-manager/config/queries/mongoose.js b/packages/strapi-plugin-content-manager/config/queries/mongoose.js
index e5efe8f7db..c80dbd7fbe 100644
--- a/packages/strapi-plugin-content-manager/config/queries/mongoose.js
+++ b/packages/strapi-plugin-content-manager/config/queries/mongoose.js
@@ -106,11 +106,12 @@ module.exports = {
const request = await this.create(values)
.catch((err) => {
- const message = err.message.split('index:');
- const field = _.words(_.last(message).split('_')[0]);
- const error = { message: `This ${field} is already taken`, field };
-
- throw error;
+ if (err.message) {
+ const message = err.message.split('index:');
+ const field = _.words(_.last(message).split('_')[0]);
+ err = { message: `This ${field} is already taken`, field };
+ }
+ throw err;
});
// Transform to JSON object.