Merge branch 'master' into chore/clean-deps

This commit is contained in:
Alexandre BODIN 2020-07-29 17:49:54 +02:00 committed by GitHub
commit c3e9b6c8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 827 additions and 982 deletions

View File

@ -5,3 +5,5 @@ updates:
schedule:
interval: 'daily'
versioning-strategy: increase
reviewers:
- strapi/maintainers

View File

@ -23,11 +23,66 @@ cache:
# end to end testing template
e2e_tests: &e2e_tests
stage: 'End to End tests'
stage: 'End to End tests CE'
script:
- STRAPI_DISABLE_EE=true yarn run -s test:generate-app -- $DB_STRING
- STRAPI_DISABLE_EE=true yarn run -s test:start-app & wait-on http://localhost:1337
- STRAPI_DISABLE_EE=true yarn run -s test:e2e
# end to end testing template
e2e_tests_ee: &e2e_tests_ee
stage: 'End to End tests EE'
script:
- yarn run -s test:generate-app -- $DB_STRING
- yarn run -s test:start-app & wait-on http://localhost:1337
- yarn run -s test:e2e
if: fork = false
pg_test: &pg_test
name: 'E2E Postgresql'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- sudo apt-get update
- sudo apt-get --yes remove postgresql-*
- sudo apt-get install -y postgresql-11 postgresql-client-11
- sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf
- sudo service postgresql restart 11
- psql -c 'create database strapi_test;' -U postgres
env:
- DB_STRING='--dbclient=postgres --dbhost=localhost --dbport=5433 --dbname=strapi_test --dbusername=postgres --dbpassword='
mysql_test: &mysql_test
name: 'E2E Mysql'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- sudo cp $TRAVIS_BUILD_DIR/_travis/mysql.cnf /etc/mysql/conf.d/
- sudo service mysql restart
- mysql -e 'CREATE DATABASE strapi_test;'
env:
- DB_STRING='--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=travis --dbpassword='
sqlite_test: &sqlite_test
name: 'E2E Sqlite'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
env:
- DB_STRING='--dbclient=sqlite --dbfile=./tmp/data.db'
mongo_test: &mongo_test
name: 'E2E MongoDB'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.6.tgz
- tar -zxvf mongodb-linux-x86_64-3.6.6.tgz
- mkdir -p ./data/db/27017
- mkdir -p ./data/db/27000
- ./mongodb-linux-x86_64-3.6.6/bin/mongod --fork --dbpath ./data/db/27017 --syslog --port 27017
env:
- DB_STRING='--dbclient=mongo --dbhost=localhost --dbport=27017 --dbname=strapi_test --dbusername= --dbpassword='
before_script:
- yarn build
@ -55,47 +110,25 @@ jobs:
- yarn run -s test:front && codecov -C -F front
- <<: *e2e_tests
name: 'E2E Postgresql'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- sudo apt-get update
- sudo apt-get --yes remove postgresql-*
- sudo apt-get install -y postgresql-11 postgresql-client-11
- sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf
- sudo service postgresql restart 11
- psql -c 'create database strapi_test;' -U postgres
env:
- DB_STRING='--dbclient=postgres --dbhost=localhost --dbport=5433 --dbname=strapi_test --dbusername=postgres --dbpassword='
<<: *pg_test
- <<: *e2e_tests
name: 'E2E Mysql'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- sudo cp $TRAVIS_BUILD_DIR/_travis/mysql.cnf /etc/mysql/conf.d/
- sudo service mysql restart
- mysql -e 'CREATE DATABASE strapi_test;'
env:
- DB_STRING='--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=travis --dbpassword='
<<: *mysql_test
- <<: *e2e_tests
name: 'E2E Sqlite'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
env:
- DB_STRING='--dbclient=sqlite --dbfile=./tmp/data.db'
<<: *sqlite_test
- <<: *e2e_tests
name: 'E2E MongoDB'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.6.tgz
- tar -zxvf mongodb-linux-x86_64-3.6.6.tgz
- mkdir -p ./data/db/27017
- mkdir -p ./data/db/27000
- ./mongodb-linux-x86_64-3.6.6/bin/mongod --fork --dbpath ./data/db/27017 --syslog --port 27017
env:
- DB_STRING='--dbclient=mongo --dbhost=localhost --dbport=27017 --dbname=strapi_test --dbusername= --dbpassword='
<<: *mongo_test
- <<: *e2e_tests_ee
<<: *pg_test
- <<: *e2e_tests_ee
<<: *mysql_test
- <<: *e2e_tests_ee
<<: *sqlite_test
- <<: *e2e_tests_ee
<<: *mongo_test

View File

@ -1,6 +1,6 @@
<p align="center">
<a href="https://strapi.io">
<img src="https://s3.us-west-2.amazonaws.com/secure.notion-static.com/899069a8-ac49-491f-b2d2-791b27799699/Logo.WhiteBackground.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAT73L2G45O3KS52Y5%2F20200519%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20200519T174202Z&X-Amz-Expires=86400&X-Amz-Signature=8a53d3ee4263f890e83c918313eaa659b8589b6d4a9300fda6b5cc99f89c56f8&X-Amz-SignedHeaders=host&response-content-disposition=filename%20%3D%22Logo.WhiteBackground.svg%22" width="318px" alt="Strapi logo" />
<img src="https://strapi.io/assets/strapi-logo-dark.svg" width="318px" alt="Strapi logo" />
</a>
</p>
<h3 align="center">API creation made simple, secure and fast.</h3>

View File

@ -160,8 +160,8 @@ module.exports = {
['/v3.x/getting-started/deployment', 'Deployment'],
['/v3.x/getting-started/contributing', 'Contributing'],
['/v3.x/getting-started/troubleshooting', 'Troubleshooting'],
['/v3.x/getting-started/usage-information', 'Telemetry'],
'/v3.x/getting-started/quick-start',
'/v3.x/getting-started/quick-start-tutorial',
],
},
{
@ -257,7 +257,7 @@ module.exports = {
{
collapsable: true,
title: '🏗 Global strapi',
children: ['/v3.x/global-strapi/api-reference', '/v3.x/global-strapi/usage-information'],
children: ['/v3.x/global-strapi/api-reference'],
},
{
collapsable: false,

View File

@ -22,7 +22,7 @@ module.exports = ({ env }) => ({
admin: {
url: '/dashboard', // We change the path to access to the admin (highly recommended for security reasons).
},
};
});
```
**You have to rebuild the administration panel to make this work.** [Build instructions](./customization.md#build).
@ -42,7 +42,7 @@ module.exports = ({ env }) => ({
url: '/', // Note: The administration will be accessible from the root of the domain (ex: http://yourfrontend.com/)
serveAdminPanel: false, // http://yourbackend.com will not serve any static admin files
},
};
});
```
After running `yarn build` with this configuration, the folder `build` will be created/overwritten. You can then use this folder to serve it from another server with the domain of your choice (ex: `http://youfrontend.com`).

View File

@ -56,6 +56,8 @@ Instead of writing those credentials into your configuration files, you can defi
**Example**
**Path —** `.env`
```
DATABASE_PASSWORD=acme
```
@ -70,7 +72,7 @@ Now you can access those variables in your configuration files and application.
In your configuration files you will have access to a `env` utility that allows defining defaults and casting values.
`config/database.js`
**Path —** `./config/database.js`
```js
module.exports = ({ env }) => ({

View File

@ -43,6 +43,8 @@ const { parseMultipartData, sanitizeEntity } = require('strapi-utils');
- `parseMultipartData`: This function parses Strapi's formData format.
- `sanitizeEntity`: This function removes all private fields from the model and its relations.
#### Collection Type
:::: tabs
::: tab find
@ -194,7 +196,7 @@ const { sanitizeEntity } = require('strapi-utils');
module.exports = {
/**
* delete a record.
* Delete a record.
*
* @return {Object}
*/
@ -212,6 +214,90 @@ module.exports = {
::::
#### Single Type
:::: tabs
::: tab find
#### `find`
```js
const { sanitizeEntity } = require('strapi-utils');
module.exports = {
/**
* Retrieve the record.
*
* @return {Array}
*/
async find(ctx) {
const entity = await strapi.services.restaurant.findOne();
return sanitizeEntity(entity, { model: strapi.models.restaurant });
},
};
```
:::
::: tab update
#### `update`
```js
const { parseMultipartData, sanitizeEntity } = require('strapi-utils');
module.exports = {
/**
* Update the record.
*
* @return {Object}
*/
async update(ctx) {
let entity;
if (ctx.is('multipart')) {
const { data, files } = parseMultipartData(ctx);
entity = await strapi.services.restaurant.createOrUpdate(data, {
files,
});
} else {
entity = await strapi.services.restaurant.createOrUpdate(ctx.request.body);
}
return sanitizeEntity(entity, { model: strapi.models.restaurant });
},
};
```
:::
::: tab delete
#### `delete`
```js
const { sanitizeEntity } = require('strapi-utils');
module.exports = {
/**
* Delete the record.
*
* @return {Object}
*/
async delete(ctx) {
const entity = await strapi.services.restaurant.delete();
return sanitizeEntity(entity, { model: strapi.models.restaurant });
},
};
```
:::
::::
## Custom controllers
You can also create custom controllers to build your own business logic and API endpoints.

View File

@ -16,6 +16,10 @@ Extensions folder structure:
- `controllers`: You can extend the plugin's controllers by creating controllers with the same names and override certain methods.
- `services`: You can extend the plugin's services by creating services with the same names and override certain methods.
::: warning
When using **extensions** you will need to update your code whenever you upgrade your strapi version. Not updating and comparing your **extensions** with the new changes on the repository, can break your app in unexpected ways that we cannot predict in the [migration guides](../migration-guide/README.md).
:::
## Admin extension
The admin panel is a `node_module` that is similar to a plugin, with the slight difference that it encapsulates all the installed plugins of your application.

View File

@ -79,6 +79,46 @@ By default this file doesn't exist, you will have to create it.
- `{middlewareName}` (Object): Configuration of one middleware
- `enabled` (boolean): Tells Strapi to run the middleware or not
### Settings
**Example**:
**Path —** `./config/middleware.js`.
```js
module.exports = {
//...
settings: {
cors: {
origin: 'http://localhost',
},
},
};
```
### Load order
The middlewares are injected into the Koa stack asynchronously. Sometimes it happens that some of these middlewares need to be loaded in a specific order. To define a load order, create or edit the file `./config/middleware.js`.
**Path —** `./config/middleware.js`.
```js
module.exports = {
load: {
before: ['responseTime', 'logger', 'cors', 'responses'],
order: [
"Define the middlewares' load order by putting their name in this array in the right order",
],
after: ['parser', 'router'],
},
};
```
- `load`:
- `before`: Array of middlewares that need to be loaded in the first place. The order of this array matters.
- `order`: Array of middlewares that need to be loaded in a specific order.
- `after`: Array of middlewares that need to be loaded at the end of the stack. The order of this array matters.
## Core middleware configurations
The core of Strapi embraces a small list of middlewares for performances, security and great error handling.
@ -139,7 +179,7 @@ The following middlewares cannot be disabled: responses, router, logger and boom
The session doesn't work with `mongo` as a client. The package that we should use is broken for now.
:::
## Response middlewares
### Response middlewares
- [`gzip`](https://en.wikipedia.org/wiki/Gzip)
- `enabled` (boolean): Enable or not GZIP response compression.
@ -178,45 +218,7 @@ The session doesn't work with `mongo` as a client. The package that we should us
- `whiteList` (array): Whitelisted IPs. Default value: `[]`.
- `blackList` (array): Blacklisted IPs. Default value: `[]`.
**Example**:
**Path —** `./config/middleware.js`.
```js
module.exports = {
//...
settings: {
cors: {
origin: 'http://localhost',
},
},
};
```
### Load order
The middlewares are injected into the Koa stack asynchronously. Sometimes it happens that some of these middlewares need to be loaded in a specific order. To define a load order, create or edit the file `./config/middleware.js`.
**Path —** `./config/middleware.js`.
```js
module.exports = {
load: {
before: ['responseTime', 'logger', 'cors', 'responses'],
order: [
"Define the middlewares' load order by putting their name in this array in the right order",
],
after: ['parser', 'router'],
},
};
```
- `load`:
- `before`: Array of middlewares that need to be loaded in the first place. The order of this array matters.
- `order`: Array of middlewares that need to be loaded in a specific order.
- `after`: Array of middlewares that need to be loaded at the end of the stack. The order of this array matters.
### Examples
## Example
Create your custom middleware.

View File

@ -796,7 +796,7 @@ xhr.send(
## Dynamic Zone
Dynamic Zone field let your create flexible space to content based on a component list.
Dynamic Zone fields let you create a flexible space, in which to compose content, based on a mixed list of components.
#### Example

View File

@ -19,6 +19,8 @@ You can read about `strapi.query` calls [here](./queries.md).
In the following example your controller, service and model are named `restaurant`.
:::
#### Collection Type
:::: tabs
::: tab find
@ -277,6 +279,102 @@ module.exports = {
::::
#### Single Type
:::: tabs
::: tab find
#### `find`
```js
const _ = require('lodash');
module.exports = {
/**
* Promise to fetch the record
*
* @return {Promise}
*/
async find(populate) {
const results = await strapi.query('restaurant').find({ _limit: 1 }, populate);
return _.first(results) || null;
},
};
```
- `populate` (array): you have to mention data you want populate `["author", "author.name", "comment", "comment.content"]`
:::
::: tab createOrUpdate
#### `createOrUpdate`
```js
const _ = require('lodash');
module.exports = {
/**
* Promise to add/update the record
*
* @return {Promise}
*/
async createOrUpdate(data, { files } = {}) {
const results = await strapi.query('restaurant').find({ _limit: 1 });
const entity = _.first(results) || null;
let entry;
if (!entity) {
entry = await strapi.query('restaurant').create(data);
} else {
entry = await strapi.query('restaurant').update({ id: entity.id }, data);
}
if (files) {
// automatically uploads the files based on the entry and the model
await strapi.entityService.uploadFiles(entry, files, {
model: 'restaurant',
// if you are using a plugin's model you will have to add the `plugin` key (plugin: 'users-permissions')
});
return this.findOne({ id: entry.id });
}
return entry;
},
};
```
:::
::: tab delete
#### `delete`
```js
module.exports = {
/**
* Promise to delete a record
*
* @return {Promise}
*/
delete() {
const results = await strapi.query('restaurant').find({ _limit: 1 });
const entity = _.first(results) || null;
if (!entity) return;
return strapi.query('restaurant').delete({id: entity.id});
},
};
```
:::
::::
## Custom services
You can also create custom services to build your own business logic.

View File

@ -144,7 +144,9 @@ Here is the list of endpoints generated for each of your **Content Types**.
::::
### Here are some Content Type examples
### Examples
Here are some Content Type examples
#### Single Types
@ -289,12 +291,20 @@ Here is the list of endpoints generated for each of your **Content Types**.
Returns entries matching the query filters. You can read more about parameters [here](./parameters.md).
:::: tabs
::: tab Request
**Example request**
```js
GET http://localhost:1337/restaurants
```
:::
::: tab Response
**Example response**
```json
@ -356,16 +366,28 @@ GET http://localhost:1337/restaurants
]
```
:::
::::
## Get an entry
Returns an entry by id.
:::: tabs
::: tab Request
**Example request**
```js
GET http://localhost:1337/restaurants/1
```
:::
::: tab Response
**Example response**
```json
@ -425,26 +447,46 @@ GET http://localhost:1337/restaurants/1
}
```
:::
::::
## Count entries
Returns the count of entries matching the query filters. You can read more about parameters [here](./parameters.md).
:::: tabs
::: tab Request
**Example request**
```js
GET http://localhost:1337/restaurants/count
```
:::
::: tab Response
**Example response**
```
1
```
:::
::::
## Create an entry
Creates an entry and returns its value.
:::: tabs
::: tab Request
**Example request**
```js
@ -478,6 +520,10 @@ POST http://localhost:1337/restaurants
}
```
:::
::: tab Response
**Example response**
```json
@ -537,11 +583,19 @@ POST http://localhost:1337/restaurants
}
```
:::
::::
## Update an entry
Partially updates an entry by id and returns its value.
Fields that aren't sent in the query are not changed in the db. Send a `null` value if you want to clear them.
:::: tabs
::: tab Request
**Example request**
```js
@ -584,6 +638,10 @@ PUT http://localhost:1337/restaurants/1
}
```
:::
::: tab Response
**Example response**
```json
@ -649,16 +707,28 @@ PUT http://localhost:1337/restaurants/1
}
```
:::
::::
## Delete an entry
Deletes an entry by id and returns its value.
:::: tabs
::: tab Request
**Example request**
```js
DELETE http://localhost:1337/restaurants/1
```
:::
::: tab Response
**Example response**
```json
@ -724,6 +794,6 @@ DELETE http://localhost:1337/restaurants/1
}
```
::: tip
Whether you are using MongoDB or a SQL database you can use the field `id` as described in this documentation. It will be provided in both cases and work the same way.
:::
::::

View File

@ -60,20 +60,20 @@ or
`GET /restaurants?_where[0][price_gte]=3&[0][price_lte]=7`
## Complexe queries
## Complex queries
::: tip NOTE
`OR` and `AND` operations are availabled starting from v3.1.0
:::
When building more complexe queries you must use the `_where` query parameter in combination with the [`qs`](https://github.com/ljharb/qs) library.
When building more complex queries you must use the `_where` query parameter in combination with the [`qs`](https://github.com/ljharb/qs) library.
We are taking advantage of the capability of `qs` to parse nested objects to create more complexe queries.
We are taking advantage of the capability of `qs` to parse nested objects to create more complex queries.
This will give you full power to create complexe queries with logical `AND` and `OR` operations.
This will give you full power to create complex queries with logical `AND` and `OR` operations.
::: tip NOTE
We strongly recommend using `qs` directly to generate complexe queries instead of creating them manually.
We strongly recommend using `qs` directly to generate complex queries instead of creating them manually.
:::
### `AND` operator
@ -212,7 +212,7 @@ To achieve this, there are three options:
:::
::: warning
This feature isn't available for the `upload` plugin.
This feature isn't available for **polymorphic** relations. This relation type is used in `media`, `component` and `dynamic zone` fields.
:::
## Sort

View File

@ -1,4 +1,4 @@
# 🦸 Contributing
# Contributing
Strapi is a community oriented project and we really appreciate every contribution made by the community: feature requests, bug reports, and especially pull requests! If you have any questions please reach out the [Core team](https://strapi.io/company) on [Slack](https://slack.strapi.io).

View File

@ -1,6 +1,12 @@
# ⚙️ Installation
# Installation
### Installation guides
Strapi gives you many possible installation options for your project or application. Strapi can be installed on your computer or services such as DigitalOcean, Amazon AWS, or Platform.sh. The following documentation covers many different options to install Strapi and getting started on using it.
::: tip
For a more detailed overview of deployment please see the [related documentation](./deployment.md).
:::
## Installation guides
<div>
<InstallLink link="../installation/cli.html">
@ -49,7 +55,3 @@
</template>
</InstallLink>
</div>
### Deployment guides
For a more detailed overview of deployment please see the [related documentation](./deployment.md).

View File

@ -1,4 +1,4 @@
# 🚀 Welcome to the Strapi documentation!
# Welcome to the Strapi documentation!
**Strapi is the open-source [Headless CMS](https://strapi.io) developers love.**
@ -62,7 +62,7 @@ To help you get started with Strapi, we and the community have provided you with
### Demo
Want to see Strapi in action? check out the [demo video](https://strapi.io/demo) or request a live demo via the form present on the page.
Want to see Strapi in action? check out the [demo video](https://youtu.be/zd0_S_FPzKg) or request a [live demo](https://strapi.io/demo) via the form present on the page.
### Blog

View File

@ -1,640 +0,0 @@
# Tutorial
This **tutorial** is written for developers to **teach and explain** a step-by-step introduction to Strapi. (The [Quick Start Guide](quick-start.md) is a more concise **How-to** version.) This tutorial takes you through the beginning steps of how you start a project like **"FoodAdvisor"** ([Github](https://github.com/strapi/foodadvisor/))([Demo](https://foodadvisor.strapi.io/)).
You get a good overview of the features found in Strapi that developers love.
<iframe width="800" height="450" src="https://www.youtube.com/embed/vulcVRQ4X8A" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
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](../installation/cli.md).
:::
**Table of Contents**
[[toc]]
## 1. Install Strapi and create a project
Navigate to your parent `Projects/` directory from your command line.
::: tip 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.
:::
**Path —** `~/Desktop/Projects/`
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
```
:::
::: 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.
::: tip NOTE
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.
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`.
:::
You see something like this. The output below indicates that your Strapi project is being downloaded and installed.
```bash
yarn create v1.17.3
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Installed "create-strapi-app@3.0.0" with binaries:
- create-strapi-app
[#####################################################################] 71/71Creating a new Strapi application at /Users/paulbocuse/Desktop/Projects/my-project.
Creating a quickstart project.
Creating files.
Dependencies installed successfully.
Your application was created at /Users/paulbocuse/Desktop/Projects/my-project.
Available commands in your project:
yarn develop
Start Strapi in watch mode.
yarn start
Start Strapi without watch mode.
yarn build
Build Strapi admin panel.
yarn strapi
Display all available commands.
You can start by doing:
cd /Users/paulbocuse/Desktop/Projects/my-project
yarn develop
Running your Strapi application.
```
Next, you notice the following that builds your Strapi administration panel and automatically starts up Strapi:
```bash
> my-project@0.1.0 develop /Users/paulbocuse/Desktop/Projects/my-project
> strapi develop
Building your admin UI with development configuration ...
✔ Webpack
Compiled successfully in 52.21s
[2019-07-30T15:21:17.698Z] info File created: /Users/paulbocuse/Desktop/Projects/my-project/extensions/users-permissions/config/jwt.json
[2019-07-30T15:21:17.701Z] info The server is restarting
[2019-07-30T15:21:19.037Z] info Time: Tue Jul 30 2019 17:21:19 GMT+0200 (Central European Summer Time)
[2019-07-30T15:21:19.037Z] info Launched in: 910 ms
[2019-07-30T15:21:19.038Z] info Environment: development
[2019-07-30T15:21:19.038Z] info Process PID: 70615
[2019-07-30T15:21:19.038Z] info Version: 3.0.0 (node v10.16.0)
[2019-07-30T15:21:19.038Z] info To shut down your server, press <CTRL> + C at any time
[2019-07-30T15:21:19.038Z] info ☄️ Admin panel: http://localhost:1337/admin
[2019-07-30T15:21:19.039Z] info ⚡️ Server: http://localhost:1337
```
![Strapi Registration Page](../assets/getting-started/tutorial/strapi-beta-registration-page.png 'Strapi Registration Page')
::: 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.**
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**.
## 2. Create an Administrator and front-end User
The first step is to create an **Administrator** (or "root user") for your project. An **Administrator** has all administrator privileges and access rights. (You can read more about why **Administrators** and front-end **Users** are separate [here](https://strapi.io/blog/why-we-split-the-management-of-the-admin-users-and-end-users/).)
You need to complete the following fields:
- **Username**, create a username for login access to your project, e.g. `paulbocuse`.
- **Password**, create a unique password for logging into your project.
- **Email address**, this is used for recovery.
- Check **Receive news**, this is optional but **recommended**.
- Click the **Ready to Start** button.
![Completed Registration Page](../assets/getting-started/tutorial/completed-registration-page.png 'Completed Registration Page')
After your **Administrator** registration is complete, you see the Strapi _Administration Dashboard_:
![Strapi Administration Dashboard](../assets/getting-started/tutorial/strapi-dashboard.png 'Strapi Admin Dashboard')
**Administrators** and front-end **Users** are separate roles.
**A.** An **Administrator** has access and rights to the Administration Dashboard (or backend) of Strapi. **Administrators** can, for example, add content, add plugins, and upload images.
**B.** A front-end **User** is someone who interacts with your project through the front-end. A front-end **User** can, for example, be an "Author" of an article, make a purchase, has an account, leaves a review, or leaves a comment.
Up until this point, you have created an **Administrator**, and so you next want to create a front-end **User**.
::: 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 **COLLECTION TYPES** in the left-hand menu.
- Click the blue **+ Add New User** button in the top right corner.
- Next, complete the `Username`, `Email`, and `Password` fields.
- Select `ON` for the **Confirmed** toggle field.
- To the right, under **Role**, select `Authenticated`.
- Save the new user by clicking the blue **Save** button (top right).
![New front-end User](../assets/getting-started/tutorial/new-front-end-user.png 'New front-end User')
You are now ready to create your first **Collection Type**.
## 3. Create a new Collection Type called "Restaurant"
A **Content Type** can be considered a sort of _blueprint_ for the data created. In other words, a **Content Type** is the schema of the data structure.
Both **Collection Type** and **Single Type** are types of **Content Type**. **Collection Type** is used for content that repeats such as restaurants, or blog posts (hence "collection"). **Single Type** is used to manage content that will have only one instance - for example, your menu, a static page, or a footer.
**Content Type** can hold data represented by fields. For example, a **Collection Type** called `Restaurant` may be intended to display information regarding restaurants. A `restaurant` **Collection Type** could have fields that include a `name`, the main `image`, and a `description` - _at a minimum_. However, a `restaurant` could also have a `category` or multiple `categories`, and a `restaurant` could perhaps need to show `hoursofoperation`.
The next section guides you through the steps needed for each of these above **Content Type** fields.
::: tip NOTE
Additional **Restaurant** themed **Content Types** and fields can be seen in the [FoodAdvisor demo site](https://foodadvisor.strapi.io/).
:::
### The Restaurant Content Type
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`.
![Content Type Dashboard](../assets/getting-started/tutorial/content-type-dashboard.png 'Content Type Dashboard')
You need to create a new **Content Type** for `Restaurants`.
1. Complete these steps to **Add a Restaurant Content Type**.
- Click the `+ Create new collection type` link (under existing **CONTENT TYPES**).
- Enter a **Name** for your new **Content Type** (call this `restaurant`).
- Click the `Continue` button.
![Singular Name Entries for Content Type](../assets/getting-started/tutorial/singular-name-entry.png 'Singular Name Entries or Content Type')
::: tip NOTE
The Content Type **Name** is always **singular**. For example, `restaurant` not `restaurants`.
:::
2. You are now at the **Field Selection** panel.
You may add your first field, a **Text** field for the **Restaurant** name.
![Field Section Panel](../assets/getting-started/tutorial/field-selection-panel.png 'Field Selection Panel')
- Click on the `Text` field.
- In the **Name** field, type `name`.
![Restaurant Name Input Field](../assets/getting-started/tutorial/restaurant-name-input-field.png 'Restaurant Name Input Field')
- Click on the `ADVANCED SETTINGS` tab.
- Check the `Required field` checkbox.
- Check the `Unique field` checkbox.
![Restaurant Name Advanced Settings](../assets/getting-started/tutorial/restaurant-name-advanced-settings.png 'Restaurant Name Advanced Settings')
- Click the `+ Add another field` button.
You are now ready to add the second field, a **Rich Text** field for the **Restaurant** description.
![Field Section Panel](../assets/getting-started/tutorial/field-selection-panel-after-restaurant-name.png 'Field Selection Panel')
- Click the `Rich Text` field.
- In the **Name** field, type `description`.
![Restaurant Rich Text Field](../assets/getting-started/tutorial/restaurant-rich-text-field.png 'Restaurant Rich Text Field')
- Click the `+ Add another field` button.
You are now ready to add the third field, a **Media** field for the **Restaurant** thumbnail image.
![Field Section Panel](../assets/getting-started/tutorial/field-selection-panel-after-restaurant-description.png 'Field Selection Panel')
- Click the `Media` field.
- In the **Name** field, type `image`.
![Restaurant Rich Image Field](../assets/getting-started/tutorial/restaurant-image-field.png 'Restaurant Rich Image Field')
- Click on the **ADVANCED SETTINGS** tab.
- Check the `Required field` checkbox.
![Restaurant Rich Image Field Advanced Settings](../assets/getting-started/tutorial/restaurant-image-field-advanced-settings.png 'Restaurant Rich Image Field Advanced Settings')
- Click the `Finish` button.
Your new Content Type called **Restaurant** is ready to be **Saved**.
![Restaurant Save Screen](../assets/getting-started/tutorial/restaurant-save-screen.png 'Restuarant Save Screen')
- Click the `Save` button.
- Wait for Strapi to restart.
![Strapi Restart](../assets/getting-started/tutorial/restaurant-strapi-restart.png 'Strapi Restart')
After Strapi has restarted, you are ready to continue to create the `Category` **Content Type**.
## 4. Create a new Content Type called "Category"
### The Category Content Type
The `Category` **Content Type** will have a **Text** field named `category`, and a **Relation field** with a **Many to Many** relationship.
![Category Add Content Type](../assets/getting-started/tutorial/category-add-content-type.png 'Category Add Content Type')
1. Complete these steps to **add a Category Content Type**.
- Click the `+ Create new collection type` link.
- Enter a **Name** for your new **Content Type** (call this `category`).
![Category Name Field](../assets/getting-started/tutorial/category-name-field.png 'Category Name Field')
- Click the `Continue` button.
2. Now, you are ready to add fields to your **Category**.
![Category Fields](../assets/getting-started/tutorial/category-fields.png 'Category Fields')
- Click on the `Text` field.
- In the **Name** field, type `name`.
![Category Name Entry Field](../assets/getting-started/tutorial/category-name-entry-field.png 'Category Name Entry Fields')
- Click on the `ADVANCED SETTINGS` tab.
- Check the `Required field` checkbox.
- Check the `Unique field` checkbox.
![Category Advanced Settings](../assets/getting-started/tutorial/category-advanced-settings.png 'Category Advanced Settings')
- Click the `+ Add another field` button.
You are now ready to add the second field, a **Relation** field for creating a **Many to Many** relationship between the **Category** and **Restaurant** Content Types.
- Click on the `Relation` field.
![Category Add Field Panel](../assets/getting-started/tutorial/category-add-field-panel-after-category-name.png 'Category Add Field Panel')
This brings you to the **Add New Relation** screen.
![Category New Relation Field](../assets/getting-started/tutorial/category-new-relation-field.png 'Category New Relation Field')
- Click on the _right dropdown_ with `Permission (Users-Permissions)` and change it to `Restaurant`.
![Category Relation Dropdown](../assets/getting-started/tutorial/category-relation-dropdown.png 'Category Relation Dropdown')
- Click the `Many to Many` icon (from the middle icon choices). It should now read, **"Categories has and belongs to many Restaurants"**.
![Category Relation Many to Many](../assets/getting-started/tutorial/category-relation-many-to-many.png 'Category Relation Many to Many')
- Click the `Finish` button.
![Category Save](../assets/getting-started/tutorial/category-save.png 'Category Save')
- Click the `Save` button.
- Wait for Strapi to restart.
![Category Save Strapi Restart](../assets/getting-started/tutorial/categor-create-strapi-restart.png 'Category Save Strapi Restart')
After Strapi has restarted, you are ready to create a `Component` called **"Hours of Operations"**.
## 5. Create a new Component called, "Hours of Operation"
### The Hours of Operation Component
The `Restaurant` Content Type has a **Component** field named `hours_of_operation`. This Component is **Repeatable** and for displaying the **Opening hours** and **Closing hours** of a **Restaurant**.
1. Complete these steps to **add a new Component**.
- Click the `+ Create new component` link to add a new **Component**.
- Enter a **Name** for your new **Component** (call this `hours_of_operation`).
- Select the icon of your choice.
- Create a new category for your **Component** (call it `hours`).
![Hours of Operation Add Component](../assets/getting-started/tutorial/hours-of-operation-add-compo.png 'Hours of Operation Add Component')
- Click the `continue` button.
2. Now, you are ready to add fields to your **Component**.
![Hours of Operation Add Fields](../assets/getting-started/tutorial/hours-of-operation-add-fields.png 'Hours of Operation Add Fields')
- Click on the `Text` field.
- In the **Name** field, type `day_interval`. This is to enter the **Day (or Days)** with **Hours of Operation**.
![Hours of Operation Days](../assets/getting-started/tutorial/hours-of-operation-days.png 'Hours of Operation Days')
- Click on the `ADVANCED SETTINGS` tab.
- Check the `Required field` checkbox.
![Hours of Operation Days Advanced Settings](../assets/getting-started/tutorial/hours-of-operation-days-advanced-settings.png 'Hours of Operation Days Advanced Settings')
- Click the `+ Add another field`.
You are now ready to add a second field, another **Text** field for the **Opening Hours**.
![Hours of Operation Opening Hours](../assets/getting-started/tutorial/hours-of-operation-opening-hours.png 'Hours of Operation Opening Hours')
- Click on the `Text` field.
- In the **Name** field, type `opening_hours`.
![Hours of Operation Opening Hours Name](../assets/getting-started/tutorial/hours-of-operation-opening-hours-name.png 'Hours of Operation Opening Hours Name')
- Click the `+ Add another field` button.
You are now ready to add a third field, another **Text** field for the **Closing Hours**.
![Hours of Operation Closing Hours](../assets/getting-started/tutorial/hours-of-operation-closing-hours.png 'Hours of Operation Closing Hours')
- Click on the `Text` field.
- In the **Name** field, type `closing_hours`.
![Hours of Operation Closing Hours Name](../assets/getting-started/tutorial/hours-of-operation-closing-hours-name.png 'Hours of Operation Closing Hours Name')
- Click the `Finish` button.
![Hours of Operation Save](../assets/getting-started/tutorial/hours-of-operation-save.png 'Hours of Operation Save')
- Click the `Save` button.
- Wait for Strapi to restart.
![Hours of Operation Strapi Restart](../assets/getting-started/tutorial/hours-of-operation-strapi-restart.png 'Hours of Operation Strapi Restart')
After Strapi has restarted, you are ready to assign this **Hours_of_operation** Component to the **Restaurant** Content Type.
::: tip NOTE
It would be possible to assign the **Hours_of_operation** Component to another **Content Type**, let's say, a **Cafe** Content Type. You have the option to reuse this component across your application.
:::
3. Next, you need to assign the **Hours_of_operation** Component to the **Restaurant** Content Type.
To access the **Hours_of_operation** Component from within the **Restaurant** Content Type, you need to **edit** the **Restaurant** Content Type in the **Content Type Builder**.
- If needed, navigate back to the **Content Type Builder**.
![Edit Restaurant Content Type](../assets/getting-started/tutorial/edit-restaurant-content-type.png 'Edit Restaurant Content Type')
- Click on the `Restaurant` Content Type, under **CONTENT TYPES**.
![Edit Restaurant Add Another Field](../assets/getting-started/tutorial/edit-restaurant-add-another-field.png 'Edit Restaurant Add Another Field')
- Click on the `+ Add another field` button to add the **Component**
![Edit Restaurant Component Field](../assets/getting-started/tutorial/edit-restaurant-group-field.png 'Edit Restaurant Component Field')
- Click on the `Component` field.
- Select `Use an existing component` option.
- Click on the `Select a component` button.
![Restaurant Component Inputs](../assets/getting-started/tutorial/restaurant-group-inputs-use.png 'Restaurant Component Inputs')
- Ensure `hours_of_operation` is displayed in the **Select a component** dropdown.
- Provide a **name** for this component in the **Restaurant** Content Type. E.g. `restaurant_hours`
- Select the `Repeatable component` option.
![Restaurant Component Inputs](../assets/getting-started/tutorial/restaurant-group-inputs.png 'Restaurant Component Inputs')
- Click on the `ADVANCED SETTINGS` tab.
- Check the `Required field` checkbox.
![Restaurant Component Advanced Settings](../assets/getting-started/tutorial/restaurant-group-advanced-settings.png 'Restaurant Component Advanced Settings')
- Click the `Finish` button.
![Restaurant Component Save](../assets/getting-started/tutorial/restaurant-group-save.png 'Restaurant Component save')
- Click the `Save` button.
- Wait for Strapi to restart.
![Restaurant Component Strapi Restart](../assets/getting-started/tutorial/restaurant-group-strapi-restart.png 'Restaurant Component Strapi Restart')
After Strapi has restarted, you are ready to continue to the next section where you customize the user-interface of your **Restaurant** Content Type.
4. Next, you will edit the **View Settings** for the new **Hoursofoperation Component** from within the **Content Manager**.
You can _drag and drop_ fields into a different layout and _rename the labels_. This are two examples of how you can customize the user interface for your **Content Types**.
- Click on the `Configure the view`, button.
![Content Manager](../assets/getting-started/tutorial/content-manager-restaurant.png 'Content Manager')
- Click on the `Set the component's layout`.
![Content Manager Components Tab](../assets/getting-started/tutorial/content-manager-restaurant-group.png 'Content Manager Components Tab')
- Rearrange the fields and make them more user friendly. Grab the `opening_hours` and slide it next to `closing_hours`.
![Content Manager Hoursofoperation Rearrange Fields](../assets/getting-started/tutorial/content-manager-hoursofoperation-rearrange-fields.png 'Content Manager Hoursofoperation Rearrange Fields')
Next, you will change the **field labels** to make them easier to understand.
- Click on the `day_interval` field.
- Edit the **Label** to read, `Day (or Days)`.
- Add a **Description**, `You can type in one day or a series of days to complete this field. E.g. "Tuesday" or "Tues - Wed"`.
![Content Manager Hoursofoperation Day Interval](../assets/getting-started/tutorial/content-manager-hoursofoperation-day-interval.png 'Content Manager Hoursofoperation Day Interval')
- Click on the `opening_hours` field.
- Edit the **Label** to read, `Opening Hours`.
![Content Manager Hoursofoperation Opening Hours](../assets/getting-started/tutorial/content-manager-hoursofoperation-day-opening-hours.png 'Content Manager Hoursofoperation Day Opening Hours')
- Click on `closing_hours` field.
- Edit the **Label** to read, `Closing Hours`.
![Content Manager Hoursofoperation Closing Hours](../assets/getting-started/tutorial/content-manager-hoursofoperation-day-closing-hours.png 'Content Manager Hoursofoperation Day Closing Hours')
- Click the `Save` button, and then the `Confirm` button to save your settings.
Your settings have now saved.
Whenever anyone enters in information for a **Restaurant**, the entry form is cleared. With Strapi you can modify these and more settings to provide the best experience possible.
You are ready to start inputting actual content.
## 6. Manage and add content to a "Restaurant" Content Type
You are now ready to add some **Restaurants** and **Categories**.
1. You are now going to enter a new **Restaurant**.
- Navigate to and click on the `Restaurants`, under **CONTENT TYPES** in the left-hand menu.
![Restaurants Content Type](../assets/getting-started/tutorial/restaurants-content-type.png 'Restaurants Content Type')
- Next, click on the **+ Add new Restaurant** button (in the top right corner).
- Enter in the following information for your first **Restaurant** called **Biscotte Restaurant**.
- In the **Name** field, enter `Biscotte Restaurant`.
- In the **Description** field, enter `Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers.`.
- Upload an **Image** to represent the **Restaurant**.
**Note:** At this point, you would generally select the **Categories** for this **Restaurant**. You have not entered any **Categories**, so you do this step after entering this first **Restaurant**.
![Restaurant Content Type Basic Data](../assets/getting-started/tutorial/restaurant-content-type-basic-data.png 'Restaurant Content Type Basic Data')
- Next scroll down to **RestaurantHours|(0)** and click the `+ ADD NEW ENTRY` button.
- In the **Create an Entry** section, enter the following details.
- In the **Day (or Days)** field, enter `Sun - Mon`.
- In the **Opening Hours** field, enter `Closed`.
- **Skip** the **Closing Hours** field, as this **Restaurant** is closed all day.
- Click the `+ ADD NEW ENTRY` button to create another new entry.
- In the **Day (or Days)** field, enter `Tues - Fri`.
- In the **Opening Hours** field, enter `12:00`.
- In the **Closing Hours** field, enter `22:30`.
- Click the `+ ADD NEW ENTRY` button to create the last entry.
- In the **Day (or Days)** field, enter `Sat`.
- In the **Opening Hours** field, enter `11:30`.
- In the **Closing Hours** field, enter `16:00`.
You have now entered in all the information necessary for your first **Restaurant**.
![Restaurants Entry](../assets/getting-started/tutorial/restaurants-entry.png 'Restaurants Entry')
- **Scroll up** and click the `Save` button.
Next, you need to enter in some **Categories** that can relate to the above and other **Restaurants**.
- Navigate to and click on `Categories`, under **CONTENT TYPES** in the left-hand menu.
![Categories Entry](../assets/getting-started/tutorial/categories-content-type.png 'Categories Entry')
You are going to enter two **Categories**, but you could add as many **Categories** as you need. Later, you can add additional **Categories** and assign them to existing and new **Restaurants**.
- Click on the `+ Add New Category` button.
- In the **Name** field, enter `French food`.
- In the **Restaurants(0)** dropdown, select `Biscotte Restaurant`.
![Categories Entry 1](../assets/getting-started/tutorial/categories-entry-1.png 'Categories Entry 1')
- Click the `Save` button.
You now enter your second **Category**.
- Click on the `+ Add New Category` button.
- In the **Name** field, enter `Brunch`.
- In the **Restaurants(0)** dropdown, select `Biscotte Restaurant`.
![Categories Entry 2](../assets/getting-started/tutorial/categories-entry-2.png 'Categories Entry 2')
- Click the `Save` button.
You have now entered your first **Restaurant** Content Type. You have also assigned two **Categories** to this **Restaurant**. Your next step is to set the **Roles and Permissions**.
## 7. Set Roles and Permissions
By default, Strapi publishes all **Content Types** with restricted permissions. Which means you have to explicitly give permissions to each **Content Type** you create. You are going to give **Public** API (or URL) access to both the **Restaurant** Content Type and **Category** Content Type.
- Click on the `Roles & Permissions` menu item, under **PLUGINS** in the left-hand-menu.
![Roles and Permissions](../assets/getting-started/tutorial/roles-and-permissions.png 'Roles And Permissions')
- Next, click on the **Public** Role.
![Roles and Permissions Public Role](../assets/getting-started/tutorial/roles-and-permissions-public-role.png 'Roles And Permissions Public Role')
- Next, scroll down under **Permissions** and locate the **Restaurant** and **Category** Content Types.
- Click the checkbox for **find** and **findone** in the **Restaurant** Content Type.
- Click the checkbox for **find** and **findone** in the **Category** Content Type.
![Roles and Permissions Find Permissions](../assets/getting-started/tutorial/roles-and-permissions-find-permissions.png 'Roles And Permissions Find Permissions')
- Scroll back to the top, and click the **Save** button.
You have now opened the API and are ready to consume the content.
## 8. Consume the Content Type API
Each of your **Content Types** are accessible by following their automatically generated routes.
Both your **Restaurant** and **Category** Content Types can now be accessed.
- In your browser, follow `http://localhost:1337/restaurants` to return the data for the allowed **Find** value of your **Restaurant** Content Type
![Restaurant Api](../assets/getting-started/tutorial/restaurant-api.png 'Restaurant API')
- In your browser, follow `http://localhost:1337/categories` to return the data for the allowed **Find** value of your **Category** Content Type.
![Category Api](../assets/getting-started/tutorial/category-api.png 'Category API')
::: tip NOTE
If you have incorrectly (or not at all) set the permissions of your content type, you get a **"403"** permission error. See the below example.
Forbidden Access Looks like this:
![Forbidden Access to Restaurant Content Type](../assets/getting-started/tutorial/permission-forbidden-access.png 'Forbidden Access to Restaurant Content Type')
:::
::: tip NOTE
If you would like to see the route of any specific **Content Type**, you need to navigate to the **Content Type** under the **Roles and Permissions** plugin and click the ⚙️ next to the value. On the right, you see the route:
![Permission Routes](../assets/getting-started/tutorial/permission-routes.png 'Permission Routes')
:::
::: tip CONGRATULATIONS
👏 Congratulations, you have now completed the **Strapi Getting Started Tutorial**. Where to go next?
- Learn how to use Strapi with React ([Gatsby](https://strapi.io/blog/building-a-static-website-using-gatsby-and-strapi) or [Next.js](https://strapi.io/blog/strapi-next-setup/)) or Vue.js ([Nuxt.js](https://strapi.io/blog/cooking-a-deliveroo-clone-with-nuxt-vue-js-graphql-strapi-and-stripe-setup-part-1-7/)).
- Read the **concepts** to deep dive into Strapi.
- Get help on [Github Discussions](https://github.com/strapi/strapi/discussions).
- Read the [source code](https://github.com/strapi/strapi), [contribute](https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md) or [give a star](https://github.com/strapi/strapi) on GitHub.
- Follow us on [Twitter](https://twitter.com/strapijs) to get the latest news.
- [Join the vibrant and active Strapi community](https://slack.strapi.io) on Slack.
:::

View File

@ -1,12 +1,12 @@
# Quick Start Guide
Get ready to get Strapi up and running in **less than 5 minutes** 🚀.
Get ready to get Strapi up and running in **less than 3 minutes** 🚀.
<div class="video-container">
<iframe width="853" height="480" src="https://www.youtube.com/embed/4m1wKzzfs-M" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="853" height="480" src="https://www.youtube.com/embed/zd0_S_FPzKg" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
_For a step-by-step guide, please take a look at the [detailed tutorial](quick-start-tutorial.md)._
_For a step-by-step guide, please take a look at the following steps. This quickstart is really close to the [FoodAdvisor](https://github.com/strapi/foodadvisor) application._
(Before continuing, please make sure [Node.js and npm are properly installed](../installation/cli.md#step-1-make-sure-requirements-are-met) on your machine. You can [install the Yarn v1.2.0+ package here](https://yarnpkg.com/en/).)
@ -45,14 +45,14 @@ Navigate to [**PLUGINS** - **Content Type Builder**](http://localhost:1337/admin
- Click the **"+ Create new collection type"** link
- Enter `restaurant`, and click `Continue`
- A window opens with fields options:
- Click the **Text** field
- Type `name` in the **Name** field
- Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field`
- Click the **"+ Add another Field"** button
- Click the **Rich Text** field
- Type `description` under the **BASE SETTINGS** tab, in the **Name** field
- Click `Finish`
- Click the **"+ Add another Field"** button
- Click the **Text** field
- Type `name` in the **Name** field
- Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field`
- Click the **"+ Add another Field"** button
- Click the **Rich Text** field
- Type `description` under the **BASE SETTINGS** tab, in the **Name** field
- Click `Finish`
- Click the **Save** button and wait for Strapi to restart
## 4. Create a Category Content type
@ -61,15 +61,15 @@ Navigate back to [**PLUGINS** - **Content Type Builder**](http://localhost:1337/
- Click the **"+ Create new collection type"** link
- Enter `category`, and click `Continue`
- A window opens with fields options:
- Click the **Text** field
- Type `name` under the **BASE SETTINGS** tab, in the **Name** field
- Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field`
- Click the **"+ Add another field"** button
- Click the **Relation** field
- On the right side, click the **Category** dropdown and select, `Restaurant`
- In the center, select the icon that represents `many-to-many`. The text should read, `Categories has and belongs to many Restaurants`
- Click `Finish`
- Click the **"+ Add another Field"** button
- Click the **Text** field
- Type `name` under the **BASE SETTINGS** tab, in the **Name** field
- Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field`
- Click the **"+ Add another field"** button
- Click the **Relation** field
- On the right side, click the **Category** dropdown and select, `Restaurant`
- In the center, select the icon that represents `many-to-many`. The text should read, `Categories has and belongs to many Restaurants`
- Click `Finish`
- Click the **Save** button and wait for Strapi to restart
## 5. Add content to "Restaurant" Content Type

View File

@ -1,4 +1,4 @@
# 💬 Troubleshooting
# Troubleshooting
Below are solutions to some common issues that you may experience when working with Strapi. You can also post questions to [Github Discussions](https://github.com/strapi/strapi/discussions) or reach out to the members of our [Slack](https://slack.strapi.io) community!
@ -84,7 +84,7 @@ You gain the ability to modify these files without forking the plugin package, h
### Can I add my own 3rd party auth provider
Yes you can either follow the following [guide](../plugins/users-permissions.md#adding-a-new-provider-to-your-project) or you can take a look at the [users-permissions](https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-users-permissions) and submit a pull request to include the provider for everyone. Eventually Strapi does plan to move from the current grant/purest provider to a split natured system similar to the upload providers.
Yes, you can either follow the following [guide](../plugins/users-permissions.md#adding-a-new-provider-to-your-project) or you can take a look at the [users-permissions](https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-users-permissions) and submit a pull request to include the provider for everyone. Eventually Strapi does plan to move from the current grant/purest provider to a split natured system similar to the upload providers.
There is currently no ETA on this migration however.

View File

@ -44,6 +44,11 @@ const _ = require('lodash');
module.exports = async (ctx, next) => {
let role;
if (ctx.state.user) {
// request is already authenticated in a different way
return next();
}
// add the detection of `token` query parameter
if (
(ctx.request && ctx.request.header && ctx.request.header.authorization) ||

View File

@ -86,7 +86,7 @@ Here we want to force it to fetch articles that have status equal to `published`
The way to do that is to set `ctx.query.status` to `published`.
It will force the filter of the query.
**Path —** `./api/restaurant/controller/Restaurant.js`
**Path —** `./api/article/controller/Article.js`
```js
const { sanitizeEntity } = require('strapi-utils');

View File

@ -8,7 +8,7 @@ Fast-track local install for getting Strapi running on your computer.
#### Node.js
Strapi only requires [Node.js](https://nodejs.org). The current recommended version to run strapi is Node v12 (current LTS).
Strapi only requires [Node.js](https://nodejs.org). The current recommended version to run strapi is **Node v12** (current LTS).
This is everything you need to run Strapi on your local environment.

View File

@ -21,7 +21,7 @@ services:
strapi:
image: strapi/strapi
volumes:
- ./:/srv/app
- ./app:/srv/app
ports:
- '1337:1337'
```
@ -42,22 +42,21 @@ services:
DATABASE_PORT: 5432
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
links:
- postgres:postgres
volumes:
- ./app:/srv/app
ports:
- '1337:1337'
depends_on:
- postgres
postgres:
image: postgres
environment:
POSTGRES_DB: strapi
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
volumes:
- ./data:/var/lib/postgresql/data
ports:
- '5432:5432'
```
:::
@ -76,22 +75,21 @@ services:
DATABASE_PORT: 27017
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
links:
- mongo:mongo
volumes:
- ./app:/srv/app
ports:
- '1337:1337'
depends_on:
- mongo
mongo:
image: mongo
environment:
MONGO_INITDB_DATABASE: strapi
MONGO_INITDB_ROOT_USERNAME: strapi
MONGO_INITDB_ROOT_PASSWORD: strapi
volumes:
- ./data/db:/data/db
ports:
- '27017:27017'
- ./data:/data/db
```
:::

View File

@ -2,6 +2,12 @@
**Make sure your server is not running until the end of the migration**
:::warning
If you are using **extensions** to create custom code or modifying existing code, you will need to update your code and compare your version to the new changes on the repository.
<br>
Not updating your **extensions** can break your app in unexpected ways that we cannot predict.
:::
## Summary
[[toc]]

View File

@ -60,9 +60,7 @@ await strapi.plugins.email.services.email.sendTemplatedEmail(
## Configure the plugin
### Install the provider you want
By default Strapi provides a local email system ([sendmail](https://www.npmjs.com/package/sendmail)). If you want to use a third party to send emails, you need to install the correct provider module. Otherwise you can skip this part and continue to [Configure your provider](#configure-your-provider).
By default Strapi provides a local email system ([sendmail](https://www.npmjs.com/package/sendmail)). If you want to use a third party to send emails, you need to install the correct provider module. Otherwise you can skip this part and continue to configure your provider.
You can check all the available providers developed by the community on npmjs.org - [Providers list](https://www.npmjs.com/search?q=strapi-provider-email-)
@ -125,7 +123,7 @@ module.exports = ({ env }) => ({
If you're using a different provider depending on your environment, you can specify the correct configuration in `config/env/${yourEnvironment}/plugins.js`. More info here: [Environments](../concepts/configurations.md#environments)
:::
## Create new provider
## Create a provider
If you want to create your own, make sure the name starts with `strapi-provider-email-` (duplicating an existing one will be easier) and customize the `send` function.

View File

@ -300,16 +300,26 @@ You can check all the available providers developed by the community on npmjs.or
To install a new provider run:
```
$ npm install strapi-provider-upload-aws-s3 --save
```
:::: tabs
or
::: tab yarn
```
$ yarn add strapi-provider-upload-aws-s3
yarn add strapi-provider-upload-aws-s3
```
:::
::: tab npm
```
npm install strapi-provider-upload-aws-s3 --save
```
:::
::::
### Using scoped packages as providers
If your package name is [scoped](https://docs.npmjs.com/about-scopes) (for example `@username/strapi-provider-upload-aws2`) you need to take an extra step by aliasing it in `package.json`. Go to the `dependencies` section and change the provider line to look like this:

View File

@ -1,7 +1,7 @@
{
"name": "getstarted",
"private": true,
"version": "3.1.1",
"version": "3.1.2",
"description": "A Strapi application.",
"scripts": {
"develop": "strapi develop",
@ -13,26 +13,26 @@
},
"dependencies": {
"knex": "^0.20.0",
"lodash": "^4.17.5",
"lodash": "4.17.19",
"mysql": "^2.17.1",
"pg": "^7.10.0",
"sqlite3": "^4.0.6",
"strapi": "3.1.1",
"strapi-admin": "3.1.1",
"strapi-connector-bookshelf": "3.1.1",
"strapi-connector-mongoose": "3.1.1",
"strapi-middleware-views": "3.1.1",
"strapi-plugin-content-manager": "3.1.1",
"strapi-plugin-content-type-builder": "3.1.1",
"strapi-plugin-documentation": "3.1.1",
"strapi-plugin-email": "3.1.1",
"strapi-plugin-graphql": "3.1.1",
"strapi-plugin-upload": "3.1.1",
"strapi-plugin-users-permissions": "3.1.1",
"strapi-provider-email-mailgun": "3.1.1",
"strapi-provider-upload-aws-s3": "3.1.1",
"strapi-provider-upload-cloudinary": "3.1.1",
"strapi-utils": "3.1.1"
"strapi": "3.1.2",
"strapi-admin": "3.1.2",
"strapi-connector-bookshelf": "3.1.2",
"strapi-connector-mongoose": "3.1.2",
"strapi-middleware-views": "3.1.2",
"strapi-plugin-content-manager": "3.1.2",
"strapi-plugin-content-type-builder": "3.1.2",
"strapi-plugin-documentation": "3.1.2",
"strapi-plugin-email": "3.1.2",
"strapi-plugin-graphql": "3.1.2",
"strapi-plugin-upload": "3.1.2",
"strapi-plugin-users-permissions": "3.1.2",
"strapi-provider-email-mailgun": "3.1.2",
"strapi-provider-upload-aws-s3": "3.1.2",
"strapi-provider-upload-cloudinary": "3.1.2",
"strapi-utils": "3.1.2"
},
"strapi": {
"uuid": "getstarted"

View File

@ -1,5 +1,5 @@
{
"version": "3.1.1",
"version": "3.1.2",
"packages": [
"packages/*",
"examples/*"

View File

@ -1,6 +1,6 @@
{
"name": "create-strapi-app",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate a new Strapi application.",
"license": "SEE LICENSE IN LICENSE",
"homepage": "http://strapi.io",
@ -21,7 +21,7 @@
],
"dependencies": {
"commander": "^2.20.0",
"strapi-generate-new": "3.1.1"
"strapi-generate-new": "3.1.2"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -5,18 +5,23 @@
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useIntl } from 'react-intl';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import StyledLink from './StyledLink';
function StaticLinks() {
const { formatMessage } = useIntl();
const staticLinks = [
{
icon: 'book',
label: 'documentation',
label: formatMessage({ id: 'app.components.LeftMenuFooter.documentation' }),
destination: 'https://strapi.io/documentation',
},
{
icon: 'file',
label: formatMessage({ id: 'app.static.links.cheatsheet' }),
destination: 'https://strapi-showcase.s3-us-west-2.amazonaws.com/CheatSheet.pdf',
}
];
return (
@ -28,7 +33,7 @@ function StaticLinks() {
<li key={label}>
<StyledLink href={destination} target="_blank" rel="noopener noreferrer">
<FontAwesomeIcon icon={icon} />
<FormattedMessage id={`app.components.LeftMenuFooter.${label}`} />
<span>{label}</span>
</StyledLink>
</li>
);

View File

@ -250,6 +250,7 @@
"app.utils.defaultMessage": " ",
"app.utils.delete": "Delete",
"app.utils.filters": "Filters",
"app.static.links.cheatsheet": "CheatSheet",
"app.utils.placeholder.defaultMessage": " ",
"component.Input.error.validation.integer": "The value must be an integer",
"components.AutoReloadBlocker.description": "Run Strapi with one of the following commands:",

View File

@ -38,6 +38,7 @@
"HomePage.welcome.congrats": "おめでとうございます!",
"HomePage.welcome.congrats.content": "初期管理者としてログインしました。Strapiが提供する強力な機能を探すために、",
"HomePage.welcome.congrats.content.bold": "まずはコンテンツタイプを作ることをオススメします。",
"Media Library": "メディアライブラリ",
"New entry": "新規投稿",
"Password": "パスワード",
"Provider": "プロバイダ",
@ -203,6 +204,7 @@
"notification.error.layout": "レイアウトを復旧できませんでした",
"notification.form.error.fields": "フォームに同じエラーがあります",
"notification.form.success.fields": "保存されました",
"notification.link-copied": "クリップボードにリンクをコピーしました",
"notification.success.delete": "アイテムは削除されました",
"request.error.model.unknown": "モデルが存在しません"
}

View File

@ -1,6 +1,6 @@
{
"name": "strapi-admin",
"version": "3.1.1",
"version": "3.1.2",
"description": "Strapi Admin",
"repository": {
"type": "git",
@ -63,7 +63,7 @@
"jsonwebtoken": "8.5.1",
"koa-compose": "4.1.0",
"koa-passport": "4.1.3",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"match-sorter": "^4.0.2",
"mini-css-extract-plugin": "^0.6.0",
"moment": "^2.24.0",
@ -94,8 +94,8 @@
"reselect": "^4.0.0",
"sanitize.css": "^4.1.0",
"sift": "13.1.10",
"strapi-helper-plugin": "3.1.1",
"strapi-utils": "3.1.1",
"strapi-helper-plugin": "3.1.2",
"strapi-utils": "3.1.2",
"style-loader": "^0.23.1",
"styled-components": "^5.0.0",
"terser-webpack-plugin": "^1.2.3",

View File

@ -4,6 +4,8 @@
const { registerAndLogin } = require('../../../test/helpers/auth');
const { createAuthRequest } = require('../../../test/helpers/request');
const edition = process.env.STRAPI_DISABLE_EE === 'true' ? 'CE' : 'EE';
let rq;
const createAuthRole = async () => {
@ -42,7 +44,17 @@ describe('Admin Auth End to End', () => {
beforeAll(async () => {
const token = await registerAndLogin();
rq = createAuthRequest(token);
internals.role = await createAuthRole();
if (edition === 'EE') {
internals.role = await createAuthRole();
} else {
internals.role = (
await rq({
url: '/admin/roles',
method: 'GET',
})
).body.data[0];
}
}, 60000);
afterAll(async () => {

View File

@ -5,6 +5,8 @@ const { login, registerAndLogin, getUser } = require('../../../test/helpers/auth
const { createAuthRequest } = require('../../../test/helpers/request');
const { SUPER_ADMIN_CODE } = require('../services/constants');
const edition = process.env.STRAPI_DISABLE_EE === 'true' ? 'CE' : 'EE';
const omitTimestamps = obj => _.omit(obj, ['updatedAt', 'createdAt', 'updated_at', 'created_at']);
const getAuthToken = async () => {
@ -85,7 +87,18 @@ describe('Admin User CRUD (e2e)', () => {
beforeAll(async () => {
const token = await getAuthToken();
rq = createAuthRequest(token);
testData.role = await createUserRole();
if (edition === 'EE') {
testData.role = await createUserRole();
} else {
testData.role = (
await rq({
url: '/admin/roles',
method: 'GET',
})
).body.data[0];
}
testData.firstSuperAdminUser = await getUser();
testData.superAdminRole = await getSuperAdminRole();
});

View File

@ -68,17 +68,37 @@ module.exports = function(strapi) {
ORM,
};
return Promise.all([
mountComponents(connectionName, ctx),
mountApis(connectionName, ctx),
mountAdmin(connectionName, ctx),
mountPlugins(connectionName, ctx),
]);
return mountConnection(connectionName, ctx);
});
return Promise.all(connectionsPromises);
}
async function mountConnection(connectionName, ctx) {
if (strapi.models['core_store'].connection === connectionName) {
await mountCoreStore(ctx);
}
return Promise.all([
mountComponents(connectionName, ctx),
mountApis(connectionName, ctx),
mountAdmin(connectionName, ctx),
mountPlugins(connectionName, ctx),
]);
}
function mountCoreStore(ctx) {
return mountModels(
{
models: {
core_store: strapi.models['core_store'],
},
target: strapi.models,
},
ctx
);
}
function mountComponents(connectionName, ctx) {
const options = {
models: _.pickBy(strapi.components, ({ connection }) => connection === connectionName),
@ -90,7 +110,10 @@ module.exports = function(strapi) {
function mountApis(connectionName, ctx) {
const options = {
models: _.pickBy(strapi.models, ({ connection }) => connection === connectionName),
models: _.pickBy(
strapi.models,
({ connection }, name) => connection === connectionName && name !== 'core_store'
),
target: strapi.models,
};

View File

@ -4,7 +4,7 @@ const { singular } = require('pluralize');
const utilsModels = require('strapi-utils').models;
const relations = require('./relations');
const buildDatabaseSchema = require('./buildDatabaseSchema');
const buildDatabaseSchema = require('./build-database-schema');
const {
createComponentJoinTables,
createComponentModels,

View File

@ -1,6 +1,6 @@
{
"name": "strapi-connector-bookshelf",
"version": "3.1.1",
"version": "3.1.2",
"description": "Bookshelf hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -19,11 +19,11 @@
"bookshelf": "^1.0.1",
"date-fns": "^2.8.1",
"inquirer": "^6.3.1",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"p-map": "4.0.0",
"pluralize": "^7.0.0",
"pluralize": "^8.0.0",
"rimraf": "3.0.0",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"peerDependencies": {
"knex": "^0.20.0"

View File

@ -1,6 +1,6 @@
{
"name": "strapi-connector-mongoose",
"version": "3.1.1",
"version": "3.1.2",
"description": "Mongoose hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -15,13 +15,13 @@
},
"main": "./lib",
"dependencies": {
"lodash": "^4.17.11",
"lodash": "4.17.19",
"mongoose": "5.8.0",
"mongoose-float": "^1.0.4",
"mongoose-long": "^0.2.1",
"pluralize": "^7.0.0",
"pluralize": "^8.0.0",
"semver": "^7.3.2",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"author": {
"email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-database",
"version": "3.1.1",
"version": "3.1.2",
"description": "Strapi's database layer",
"homepage": "http://strapi.io",
"main": "./lib/index.js",
@ -28,7 +28,7 @@
},
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"lodash": "^4.17.11",
"lodash": "4.17.19",
"p-map": "4.0.0",
"verror": "^1.10.0"
}

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-api",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate an API for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@ -13,9 +13,9 @@
"lib": "./lib"
},
"dependencies": {
"lodash": "^4.17.11",
"pluralize": "^7.0.0",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"pluralize": "^8.0.0",
"strapi-utils": "3.1.2"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-controller",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate a controller for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@ -14,8 +14,8 @@
"lib": "./lib"
},
"dependencies": {
"lodash": "^4.17.11",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"strapi-utils": "3.1.2"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-model",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate a model for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@ -14,9 +14,9 @@
"lib": "./lib"
},
"dependencies": {
"lodash": "^4.17.11",
"pluralize": "^7.0.0",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"pluralize": "^8.0.0",
"strapi-utils": "3.1.2"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-new",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate a new Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@ -18,7 +18,7 @@
"execa": "^1.0.0",
"fs-extra": "^8.0.1",
"inquirer": "^6.3.1",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"node-fetch": "^1.7.3",
"node-machine-id": "^1.1.10",
"ora": "^3.4.0",

View File

@ -27,7 +27,7 @@ export default strapi => {
preventComponentRendering: false,
trads,
menu: {
pluginsSection: [
pluginsSectionLinks: [
{
destination: `/plugins/${pluginId}`,
icon,

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-plugin",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate an plugin for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@ -14,8 +14,8 @@
},
"dependencies": {
"fs-extra": "^8.0.1",
"lodash": "^4.17.11",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"strapi-utils": "3.1.2"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-policy",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate a policy for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@ -14,8 +14,8 @@
"lib": "./lib"
},
"dependencies": {
"lodash": "^4.17.11",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"strapi-utils": "3.1.2"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate-service",
"version": "3.1.1",
"version": "3.1.2",
"description": "Generate a service for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@ -14,8 +14,8 @@
"lib": "./lib"
},
"dependencies": {
"lodash": "^4.17.11",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"strapi-utils": "3.1.2"
},
"scripts": {
"test": "echo \"no tests yet\""

View File

@ -1,6 +1,6 @@
{
"name": "strapi-generate",
"version": "3.1.1",
"version": "3.1.2",
"description": "Master of ceremonies for the Strapi generators.",
"homepage": "http://strapi.io",
"keywords": [
@ -18,9 +18,9 @@
"dependencies": {
"async": "^2.6.2",
"fs-extra": "^8.0.1",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"reportback": "^2.0.2",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"author": {
"name": "Strapi team",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-helper-plugin",
"version": "3.1.1",
"version": "3.1.2",
"description": "Helper for Strapi plugins development",
"files": [
"dist"
@ -59,7 +59,7 @@
"classnames": "^2.2.5",
"immutable": "^3.8.2",
"invariant": "^2.2.1",
"lodash": "^4.17.5",
"lodash": "4.17.19",
"moment": "^2.16.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-hook-ejs",
"version": "3.1.1",
"version": "3.1.2",
"description": "EJS hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-hook-redis",
"version": "3.1.1",
"version": "3.1.2",
"description": "Redis hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -16,10 +16,10 @@
"main": "./lib",
"dependencies": {
"ioredis": "^4.9.3",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"rimraf": "3.0.0",
"stack-trace": "0.0.10",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"author": {
"email": "hi@strapi.io",

View File

@ -1,6 +1,6 @@
{
"name": "strapi-middleware-views",
"version": "3.1.1",
"version": "3.1.2",
"description": "Views middleware to enable server-side rendering for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@ -17,7 +17,7 @@
"dependencies": {
"consolidate": "^0.15.1",
"koa-views": "^6.2.0",
"lodash": "^4.17.11"
"lodash": "4.17.19"
},
"author": {
"email": "hi@strapi.io",

View File

@ -34,7 +34,11 @@ function FilterPicker({ actions, isOpen, name, onSubmit, toggleFilterPickerState
return get(matchingPermissions, ['0', 'fields'], []);
}, [userPermissions, slug]);
const timestamps = get(schema, ['options', 'timestamps']);
let timestamps = get(schema, ['options', 'timestamps']);
if (!Array.isArray(timestamps)) {
timestamps = [];
}
const allowedAttributes = Object.keys(get(schema, ['attributes']), {})
.filter(attr => {

View File

@ -123,11 +123,11 @@ function Inputs({
let step;
if (type === 'float' || type === 'decimal') {
step = 'any';
step = 0.1;
} else if (type === 'time' || type === 'datetime') {
step = 30;
} else {
step = '1';
step = 1;
}
return step;

View File

@ -9,6 +9,7 @@ import {
isNaN,
toNumber,
} from 'lodash';
import moment from 'moment';
import * as yup from 'yup';
import { translatedErrors as errorsTrads } from 'strapi-helper-plugin';
@ -285,6 +286,14 @@ const createYupSchemaAttribute = (type, validations, isCreatingEntry) => {
return !!value;
}
if (['date', 'datetime'].includes(type)) {
return moment(value)._isValid === true;
}
if (type === 'boolean') {
return value !== undefined;
}
return !isEmpty(value);
});
}

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-manager",
"version": "3.1.1",
"version": "3.1.2",
"description": "A powerful UI to easily manage your data.",
"strapi": {
"name": "Content Manager",
@ -15,7 +15,7 @@
"draft-js": "^0.11.5",
"highlight.js": "^10.1.1",
"immutable": "^3.8.2",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"markdown-it": "^11.0.0",
"markdown-it-abbr": "^1.0.4",
"markdown-it-container": "^3.0.0",
@ -26,7 +26,7 @@
"markdown-it-mark": "^3.0.0",
"markdown-it-sub": "^1.0.0",
"markdown-it-sup": "^1.0.0",
"pluralize": "^7.0.0",
"pluralize": "^8.0.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-fast-compare": "^3.2.0",
@ -38,8 +38,8 @@
"redux": "^4.0.1",
"redux-immutable": "^4.0.0",
"reselect": "^4.0.0",
"strapi-helper-plugin": "3.1.1",
"strapi-utils": "3.1.1",
"strapi-helper-plugin": "3.1.2",
"strapi-utils": "3.1.2",
"yup": "^0.27.0"
},
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-type-builder",
"version": "3.1.1",
"version": "3.1.2",
"description": "Strapi plugin to create content type (API).",
"strapi": {
"name": "Content Type Builder",
@ -11,8 +11,8 @@
"@sindresorhus/slugify": "1.1.0",
"fs-extra": "^7.0.0",
"immutable": "^3.8.2",
"lodash": "^4.17.11",
"pluralize": "^7.0.0",
"lodash": "4.17.19",
"pluralize": "^8.0.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-intl": "4.5.0",
@ -23,10 +23,10 @@
"redux": "^4.0.1",
"redux-immutable": "^4.0.0",
"reselect": "^4.0.0",
"strapi-generate": "3.1.1",
"strapi-generate-api": "3.1.1",
"strapi-helper-plugin": "3.1.1",
"strapi-utils": "3.1.1",
"strapi-generate": "3.1.2",
"strapi-generate-api": "3.1.2",
"strapi-helper-plugin": "3.1.2",
"strapi-utils": "3.1.2",
"yup": "^0.27.0"
},
"author": {

6
packages/strapi-plugin-documentation/package.json Executable file → Normal file
View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-documentation",
"version": "3.1.1",
"version": "3.1.2",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Documentation",
@ -15,7 +15,7 @@
"fs-extra": "^8.1.0",
"immutable": "^3.8.2",
"koa-static": "^5.0.0",
"lodash": "^4.17.15",
"lodash": "4.17.19",
"moment": "^2.24.0",
"path-to-regexp": "^3.1.0",
"react": "^16.9.0",
@ -29,7 +29,7 @@
"redux": "^4.0.1",
"redux-immutable": "^4.0.0",
"reselect": "^4.0.0",
"strapi-helper-plugin": "3.1.1",
"strapi-helper-plugin": "3.1.2",
"swagger-ui-dist": "3.24.3"
},
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-email",
"version": "3.1.1",
"version": "3.1.2",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Email",
@ -12,13 +12,13 @@
"test": "echo \"no tests yet\""
},
"dependencies": {
"lodash": "^4.17.11",
"strapi-provider-email-sendmail": "3.1.1",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"strapi-provider-email-sendmail": "3.1.2",
"strapi-utils": "3.1.2"
},
"devDependencies": {
"rimraf": "3.0.0",
"strapi-helper-plugin": "3.1.1"
"strapi-helper-plugin": "3.1.2"
},
"author": {
"name": "Strapi team",

View File

@ -118,6 +118,7 @@ module.exports = strapi => {
cors: false,
bodyParserConfig: true,
introspection: _.get(strapi.plugins.graphql, 'config.introspection', true),
engine: _.get(strapi.plugins.graphql, 'config.engine', false),
};
// Disable GraphQL Playground in production environment.

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-graphql",
"version": "3.1.1",
"version": "3.1.2",
"description": "This is the description of the plugin.",
"strapi": {
"name": "graphql",
@ -23,9 +23,9 @@
"graphql-type-json": "0.3.1",
"graphql-type-long": "^0.1.1",
"koa-compose": "^4.1.0",
"lodash": "4.17.12",
"pluralize": "^7.0.0",
"strapi-utils": "3.1.1"
"lodash": "4.17.19",
"pluralize": "^8.0.0",
"strapi-utils": "3.1.2"
},
"devDependencies": {
"cross-env": "^5.2.0",

View File

@ -1,10 +1,12 @@
import en from './en.json';
import ja from './ja.json';
import ms from './ms.json';
import ru from './ru.json';
import uk from './uk.json';
const trads = {
en,
ja,
ms,
ru,
uk,

View File

@ -0,0 +1,82 @@
{
"button.next": "次へ",
"checkControl.crop-duplicate": "複製したアセットをトリミングする",
"checkControl.crop-original": "元のアセットをトリミングする",
"control-card.add": "追加",
"control-card.cancel": "キャンセル",
"control-card.copy-link": "リンクをコピー",
"control-card.crop": "クロップ",
"control-card.delete": "削除",
"control-card.download": "ダウンロード",
"control-card.edit": "編集",
"control-card.replace-media": "メディアの置き換え",
"control-card.save": "保存",
"filter.add": "フィルタを追加",
"form.button.replace-media": "メディアの置き換え",
"form.input.decription.file-alt": "このテキストはアセットを表示できない場合に表示されます。",
"form.input.label.file-alt": "代替テキスト",
"form.input.label.file-caption": "キャプション",
"form.input.label.file-name": "ファイル名",
"form.upload-url.error.url.invalid": "1つのURLが無効です",
"form.upload-url.error.url.invalids": "{number}つのURLは無効です",
"header.actions.upload-assets": "アップロード",
"header.content.assets-empty": "アセットはありません",
"header.content.assets-multiple": "{number} アセット",
"header.content.assets-single": "1 アセット",
"input.button.label": "ファイルを選択",
"input.label-bold": "ドラッグ&ドロップ",
"input.label-normal": "でアップロードするか",
"input.placeholder": "クリックしてアセットを選択するか、このエリアにファイルをドラッグ&ドロップします。",
"input.url.description": "URLのリンクは改行で区切ってください。",
"input.url.label": "URL",
"list.assets-empty.subtitle": "最初の1つを追加します。",
"list.assets-empty.title": "アセットはまだありません",
"list.assets-empty.title-withSearch": "適用されたフィルターを持つアセットはありません",
"list.assets.selected.plural": "選択されたアセット数: {number}",
"list.assets.selected.singular": "選択されたアセット数: {number}",
"list.assets.type-not-allowed": "このファイルの拡張子は許可されていません。",
"modal.file-details.date": "日付",
"modal.file-details.dimensions": "寸法",
"modal.file-details.extension": "拡張",
"modal.file-details.size": "データサイズ",
"modal.header.browse": "アセットのアップロード",
"modal.header.file-detail": "詳細",
"modal.header.pending-assets": "アップロード前のアセット",
"modal.header.select-files": "選択されたファイル",
"modal.nav.browse": "ブラウズ",
"modal.nav.computer": "PCから",
"modal.nav.selected": "選りすぐり",
"modal.nav.url": "URLから",
"modal.selected-list.sub-header-subtitle": "ドラッグ&ドロップでフィールド内のアセットを並べ替える",
"modal.upload-list.footer.button.plural": "メディアライブラリに{number}つのアセットをアップロードする",
"modal.upload-list.footer.button.singular": "メディアライブラリに{number}つのアセットをアップロードする",
"modal.upload-list.sub-header-subtitle": "メディアライブラリに追加する前にアセットを管理する",
"modal.upload-list.sub-header-title.plural": "選択したアセットの数: {number}",
"modal.upload-list.sub-header-title.singular": "選択されたアセット数: {number}",
"modal.upload-list.sub-header.button": "別のアセットを追加する",
"plugin.description.long": "メディアファイルの管理",
"plugin.description.short": "メディアファイルの管理",
"notification.link-copied": "クリップボードにリンクをコピーしました。",
"plugin.name": "メディアライブラリ",
"search.placeholder": "アセットの検索...",
"settings.form.responsiveDimensions.description": "アップロードされたアセットから複数のサイズ(大、中、小)を自動的に生成します。",
"settings.form.responsiveDimensions.label": "レスポンシブに最適化するアップロードを有効にする",
"settings.form.sizeOptimization.label": "サイズの最適化を有効にする (品質は落とさない)",
"settings.form.autoOrientation.label": "画像の自動方向補正機能を有効にする",
"settings.form.autoOrientation.description": "EXIF情報に従って画像を自動的に回転させます。",
"settings.form.videoPreview.description": "動画GIFの6秒プレビューを生成します。",
"settings.form.videoPreview.label": "プレビュー",
"settings.header.label": "メディアライブラリ - 設定",
"settings.section.image.label": "イメージ",
"settings.section.video.label": "ビデオ",
"settings.sub-header.label": "メディアライブラリの設定を行う",
"sort.created_at_asc": "アップロードが古い順",
"sort.created_at_desc": "アップロードが新しい順",
"sort.label": "並び替え",
"sort.name_asc": "アルファベット順AZ",
"sort.name_desc": "アルファベット逆順Z〜A",
"sort.updated_at_asc": "アップデートが古い順",
"sort.updated_at_desc": "アップデートが新しい順",
"window.confirm.close-modal.files": "まだアップロードされていないファイルがありますが、いいですか?",
"window.confirm.close-modal.file": "保存されていない変更がありますが、いいですか?。"
}

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-upload",
"version": "3.1.1",
"version": "3.1.2",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Media Library",
@ -18,7 +18,7 @@
"is-valid-domain": "0.0.14",
"koa-range": "0.3.0",
"koa-static": "^5.0.0",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"node-fetch": "2.6.0",
"react": "^16.9.0",
"react-copy-to-clipboard": "^5.0.1",
@ -29,9 +29,9 @@
"react-router-dom": "^5.0.0",
"reactstrap": "8.4.1",
"sharp": "0.24.1",
"strapi-helper-plugin": "3.1.1",
"strapi-provider-upload-local": "3.1.1",
"strapi-utils": "3.1.1",
"strapi-helper-plugin": "3.1.2",
"strapi-provider-upload-local": "3.1.2",
"strapi-utils": "3.1.2",
"stream-to-array": "^2.3.0",
"uuid": "^3.2.1"
},

View File

@ -6,6 +6,7 @@ describe('Upload plugin bootstrap function', () => {
const register = jest.fn(() => {});
global.strapi = {
dir: process.cwd(),
admin: {
services: { permission: { actionProvider: { register } } },
},
@ -13,6 +14,10 @@ describe('Upload plugin bootstrap function', () => {
error() {},
},
config: {
get() {
return 'public';
},
paths: {},
info: {
dependencies: {},
},

View File

@ -9,13 +9,7 @@ import PropTypes from 'prop-types';
import { useEditPageContext } from '../../contexts/EditPage';
import { Label, Wrapper } from './Components';
function InputCheckboxPlugin({
inputSelected,
label,
name,
setNewInputSelected,
value,
}) {
function InputCheckboxPlugin({ inputSelected, label, name, setNewInputSelected, value }) {
const {
onChange,
resetShouldDisplayPoliciesHint,
@ -61,14 +55,11 @@ function InputCheckboxPlugin({
return (
<Wrapper className="col-md-4" onClick={handleClick}>
<div
className={`form-check ${
isSelected && policiesShown ? 'highlighted' : ''
} ${value ? 'is-checked' : ''}`}
className={`form-check ${isSelected && policiesShown ? 'highlighted' : ''} ${
value ? 'is-checked' : ''
}`}
>
<Label
className={`form-check-label ${value ? 'checked' : ''}`}
htmlFor={name}
>
<Label className={`form-check-label ${value ? 'checked' : ''}`} htmlFor={name}>
<input
className="form-check-input"
defaultChecked={value}

View File

@ -16,8 +16,10 @@ module.exports = async (ctx, next) => {
throw new Error('Invalid token: Token did not contain required fields');
}
ctx.state.user = await strapi.plugins['users-permissions'].services.user.fetch({ id });
// fetch authenticated user
ctx.state.user = await strapi.plugins[
'users-permissions'
].services.user.fetchAuthenticatedUser(id);
} catch (err) {
return handleErrors(ctx, err, 'unauthorized');
}

View File

@ -18,7 +18,6 @@ module.exports = {
* @return {Object}
*/
async create(ctx) {
console.log('hello');
const advanced = await strapi
.store({
environment: '',

View File

@ -1,6 +1,6 @@
{
"name": "strapi-plugin-users-permissions",
"version": "3.1.1",
"version": "3.1.2",
"description": "Protect your API with a full-authentication process based on JWT",
"strapi": {
"name": "Roles & Permissions",
@ -18,7 +18,7 @@
"immutable": "^3.8.2",
"jsonwebtoken": "^8.1.0",
"koa2-ratelimit": "^0.9.0",
"lodash": "^4.17.11",
"lodash": "4.17.19",
"purest": "3.1.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
@ -29,8 +29,8 @@
"reactstrap": "8.4.1",
"redux-saga": "^0.16.0",
"request": "^2.83.0",
"strapi-helper-plugin": "3.1.1",
"strapi-utils": "3.1.1",
"strapi-helper-plugin": "3.1.2",
"strapi-utils": "3.1.2",
"uuid": "^3.1.0"
},
"devDependencies": {

View File

@ -61,10 +61,18 @@ module.exports = {
* Promise to fetch a/an user.
* @return {Promise}
*/
fetch(params, populate = ['role']) {
fetch(params, populate) {
return strapi.query('user', 'users-permissions').findOne(params, populate);
},
/**
* Promise to fetch authenticated user.
* @return {Promise}
*/
fetchAuthenticatedUser(id) {
return strapi.query('user', 'users-permissions').findOne({ id }, ['roles']);
},
/**
* Promise to fetch all users.
* @return {Promise}

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-amazon-ses",
"version": "3.1.1",
"version": "3.1.2",
"description": "Amazon SES provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [
@ -15,7 +15,7 @@
"main": "./lib",
"dependencies": {
"node-ses": "^3.0.0",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"author": {
"email": "nikolay@tsenkov.net",

View File

@ -45,6 +45,7 @@ module.exports = ({ env }) => ({
provider: 'mailgun',
providerOptions: {
apiKey: env('MAILGUN_API_KEY'),
domain: env('MAILGUN_DOMAIN'), //Required if you have an account with multiple domains
},
settings: {
defaultFrom: 'myemail@protonmail.com',

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-mailgun",
"version": "3.1.1",
"version": "3.1.2",
"description": "Mailgun provider for strapi email plugin",
"homepage": "http://strapi.io",
"keywords": [
@ -14,7 +14,7 @@
"main": "./lib",
"dependencies": {
"mailgun-js": "0.22.0",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"strapi": {
"isProvider": true

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-sendgrid",
"version": "3.1.1",
"version": "3.1.2",
"description": "Sendgrid provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [
@ -14,7 +14,7 @@
"main": "./lib",
"dependencies": {
"@sendgrid/mail": "6.4.0",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"strapi": {
"isProvider": true

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-email-sendmail",
"version": "3.1.1",
"version": "3.1.2",
"description": "Sendmail provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [
@ -13,7 +13,7 @@
"main": "./lib",
"dependencies": {
"sendmail": "^1.6.1",
"strapi-utils": "3.1.1"
"strapi-utils": "3.1.2"
},
"strapi": {
"isProvider": true

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-aws-s3",
"version": "3.1.1",
"version": "3.1.2",
"description": "AWS S3 provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [
@ -15,7 +15,7 @@
"main": "./lib",
"dependencies": {
"aws-sdk": "^2.457.0",
"lodash": "^4.17.11"
"lodash": "4.17.19"
},
"strapi": {
"isProvider": true

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-cloudinary",
"version": "3.1.1",
"version": "3.1.2",
"description": "Cloudinary provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -23,6 +23,10 @@ module.exports = {
});
}
};
const uploadDir = path.join(
strapi.dir,
strapi.config.get('middleware.settings.public.path', strapi.config.paths.static)
);
return {
upload(file) {
@ -31,7 +35,7 @@ module.exports = {
return new Promise((resolve, reject) => {
// write file in public/assets folder
fs.writeFile(
path.join(strapi.config.paths.static, `/uploads/${file.hash}${file.ext}`),
path.join(uploadDir, `/uploads/${file.hash}${file.ext}`),
file.buffer,
err => {
if (err) {
@ -47,10 +51,7 @@ module.exports = {
},
delete(file) {
return new Promise((resolve, reject) => {
const filePath = path.join(
strapi.config.paths.static,
`/uploads/${file.hash}${file.ext}`
);
const filePath = path.join(uploadDir, `/uploads/${file.hash}${file.ext}`);
if (!fs.existsSync(filePath)) {
return resolve("File doesn't exist");

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-local",
"version": "3.1.1",
"version": "3.1.2",
"description": "Local provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [

View File

@ -1,6 +1,6 @@
{
"name": "strapi-provider-upload-rackspace",
"version": "3.1.1",
"version": "3.1.2",
"description": "Rackspace provider for strapi upload",
"main": "./lib",
"keywords": [],

View File

@ -15,9 +15,7 @@ module.exports = ctx => {
try {
data = JSON.parse(body.data);
} catch (error) {
throw strapi.errors.badRequest(
`Invalid 'data' field. 'data' should be a valid JSON.`
);
throw strapi.errors.badRequest(`Invalid 'data' field. 'data' should be a valid JSON.`);
}
const filesToUpload = Object.keys(files).reduce((acc, key) => {
@ -25,7 +23,8 @@ module.exports = ctx => {
if (fullPath.length <= 1 || fullPath[0] !== 'files') {
throw strapi.errors.badRequest(
`When using multipart/form-data you need to provide your files by prefixing them with the 'files'.`
`When using multipart/form-data you need to provide your files by prefixing them with the 'files'.
For example, when a media file is named "avatar", make sure the form key name is "files.avatar"`
);
}

View File

@ -1,6 +1,6 @@
{
"name": "strapi-utils",
"version": "3.1.1",
"version": "3.1.2",
"description": "Shared utilities for the Strapi packages",
"homepage": "http://strapi.io",
"keywords": [
@ -16,9 +16,9 @@
"dependencies": {
"@sindresorhus/slugify": "1.1.0",
"date-fns": "^2.8.1",
"lodash": "4.17.12",
"lodash": "4.17.19",
"pino": "^4.7.1",
"pluralize": "^7.0.0",
"pluralize": "^8.0.0",
"yup": "0.28.1"
},
"author": {

View File

@ -42,6 +42,8 @@ class Strapi {
this.app = new Koa();
this.router = new Router();
this.server = http.createServer(this.handleRequest.bind(this));
// Logger.
this.log = logger;
@ -68,6 +70,14 @@ class Strapi {
return ee({ dir: this.dir, logger });
}
handleRequest(req, res) {
if (!this.requestHandler) {
this.requestHandler = this.app.callback();
}
return this.requestHandler(req, res);
}
requireProjectBootstrap() {
const bootstrapPath = path.resolve(this.dir, 'config/functions/bootstrap.js');
@ -159,9 +169,6 @@ class Strapi {
* Add behaviors to the server
*/
async listen(cb) {
// Mount the HTTP server.
this.server = http.createServer(this.app.callback());
// handle port in use cleanly
this.server.on('error', err => {
if (err.code === 'EADDRINUSE') {

View File

@ -33,7 +33,7 @@ module.exports = strapi => {
});
_.get(strapi.admin, 'config.routes', []).forEach(route => {
composeEndpoint(route, { router });
composeEndpoint(route, { plugin: 'admin', router });
});
// Mount admin router on Strapi router

View File

@ -25,9 +25,12 @@ module.exports = strapi =>
let controller;
if (plugin) {
controller = strapi.plugins[plugin].controllers[controllerKey];
controller =
plugin === 'admin'
? strapi.admin.controllers[controllerKey]
: strapi.plugins[plugin].controllers[controllerKey];
} else {
controller = strapi.controllers[controllerKey] || strapi.admin.controllers[controllerKey];
controller = strapi.controllers[controllerKey];
}
if (!_.isFunction(controller[actionName])) {

View File

@ -1,6 +1,6 @@
{
"name": "strapi",
"version": "3.1.1",
"version": "3.1.2",
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite",
"homepage": "http://strapi.io",
"directories": {
@ -42,7 +42,7 @@
"koa-router": "^7.4.0",
"koa-session": "^5.12.0",
"koa-static": "^5.0.0",
"lodash": "^4.17.5",
"lodash": "4.17.19",
"node-fetch": "2.6.0",
"node-machine-id": "1.1.12",
"node-schedule": "1.3.2",
@ -51,16 +51,16 @@
"qs": "^6.9.3",
"resolve-cwd": "^3.0.0",
"rimraf": "^2.6.2",
"strapi-database": "3.1.1",
"strapi-generate": "3.1.1",
"strapi-generate-api": "3.1.1",
"strapi-generate-controller": "3.1.1",
"strapi-generate-model": "3.1.1",
"strapi-generate-new": "3.1.1",
"strapi-generate-plugin": "3.1.1",
"strapi-generate-policy": "3.1.1",
"strapi-generate-service": "3.1.1",
"strapi-utils": "3.1.1"
"strapi-database": "3.1.2",
"strapi-generate": "3.1.2",
"strapi-generate-api": "3.1.2",
"strapi-generate-controller": "3.1.2",
"strapi-generate-model": "3.1.2",
"strapi-generate-new": "3.1.2",
"strapi-generate-plugin": "3.1.2",
"strapi-generate-policy": "3.1.2",
"strapi-generate-service": "3.1.2",
"strapi-utils": "3.1.2"
},
"scripts": {
"postinstall": "node lib/utils/success.js"

View File

@ -65,9 +65,13 @@ const generateTestApp = async ({ appName, database }) => {
* @param {string} options.appName - Name of the app / folder in which run the start script
*/
const startTestApp = ({ appName }) => {
return execa.shell('BROWSER=none strapi develop --no-build', {
return execa('strapi', ['develop', '--no-build'], {
stdio: 'inherit',
cwd: path.resolve(appName),
env: {
FORCE_COLOR: 1,
BROWSER: 'none',
},
});
};

View File

@ -11874,15 +11874,10 @@ lodash.xorby@^4.7.0:
resolved "https://registry.yarnpkg.com/lodash.xorby/-/lodash.xorby-4.7.0.tgz#9c19a6f9f063a6eb53dd03c1b6871799801463d7"
integrity sha1-nBmm+fBjputT3QPBtocXmYAUY9c=
lodash@4.17.12:
version "4.17.12"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.12.tgz#a712c74fdc31f7ecb20fe44f157d802d208097ef"
integrity sha512-+CiwtLnsJhX03p20mwXuvhoebatoh5B3tt+VvYlrPgZC1g36y+RRbkufX95Xa+X4I59aWEacDFYwnJZiyBh9gA==
lodash@^4.1.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.7.14:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
lodash@4.17.19, lodash@^4.1.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.1, lodash@^4.7.14:
version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
log-symbols@^1.0.2:
version "1.0.2"
@ -14133,10 +14128,10 @@ please-upgrade-node@^3.1.1, please-upgrade-node@^3.2.0:
dependencies:
semver-compare "^1.0.0"
pluralize@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777"
integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==
pluralize@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==
popper.js@^1.14.4:
version "1.16.1"