未验证 提交 16c3cab7 编写于 作者: J Jim LAURIE 提交者: GitHub

Merge branch 'master' into quick-start-documentation

Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
......@@ -60,7 +60,7 @@ Node:
**Please note that right now Node 11 is not Officially supported, and the current Node LTS (v10) should be used.**
Database:
* MongoDB >= 3.x
* MongoDB >= 3.x
* MySQL >= 5.6
* MariaDB >= 10.1
* PostgreSQL >= 10
......@@ -71,7 +71,7 @@ Database:
npm install strapi@alpha -g
````
**We recommend to use the latest version of Strapi to start your new project**.
**We recommend to use the latest version of Strapi to start your new project**.
Some breaking changes might happen, new releases are shipped every two weeks to fix/enhance the product.
#### 🏗 Create a new project
......@@ -140,7 +140,7 @@ For general help using Strapi, please refer to [the official Strapi documentatio
#### Professional support
[Strapi Solutions](https://strapi.io), the company behind Strapi, provides a full range of solutions to get better results, faster. We're always looking for the next challenge: coaching, consulting, training, customization, etc.
[Strapi Solutions](https://strapi.io), the company behind Strapi, provides a full range of solutions to get better results, faster. We're always looking for the next challenge: coaching, consulting, training, customization, etc.
[Drop us an email](mailto:support@strapi.io) to see how we can help you.
......@@ -160,4 +160,4 @@ Check out our [roadmap](https://portal.productboard.com/strapi) to get informed
## License
[MIT License](LICENSE.md) Copyright (c) 2015-2018 [Strapi Solutions](https://strapi.io/).
[MIT License](LICENSE.md) Copyright (c) 2015-2019 [Strapi Solutions](https://strapi.io/).
......@@ -7,11 +7,8 @@ Enable the middleware in environments settings
**Path —** `config/environments/middleware.json`.
```json
{
"ejs": {
"enabled": true,
"viewExt": "ejs",
"debug": false,
"cache": false
"responseTime": {
"enabled": true
},
}
```
......
......@@ -106,7 +106,7 @@ Please refer to the [filters' guide](../guides/filters.md) for more informations
## Models
Models are a representation of the database's structure and lifecyle. They are split into two separate files. A JavaScript file that contains the lifecycle callbacks, and a JSON one that represents the data stored in the database and their format. The models also allow you to define the relationships between them.
Models are a representation of the database's structure and lifecycle. They are split into two separate files. A JavaScript file that contains the lifecycle callbacks, and a JSON one that represents the data stored in the database and their format. The models also allow you to define the relationships between them.
**Path —** `./api/user/models/User.js`.
```js
......
......@@ -85,7 +85,7 @@ Requests system can be implemented in custom code sections.
To extract the filters from an JavaScript object or a request, you need to call the [`strapi.utils.models.convertParams` helper](../api-reference/reference.md#strapiutils).
::: note
The returned objects is formatted according to the ORM used by the model.
The returned objects are formatted according to the ORM used by the model.
:::
#### Example
......
......@@ -24,6 +24,8 @@ By default, the [Shadow CRUD](#shadow-crud) feature is enabled and the GraphQL i
Security limits on maximum number of items in your response by default is limited to 100, however you can change this on the following config option `amountLimit`. This should only be changed after careful consideration of the drawbacks of a large query which can cause what would basically be a DDoS (Distributed Denial of Service). And may cause abnormal load on your Strapi server, as well as your database server.
You can also enable the Apollo server tracing feature, which is supported by the playground to track the response time of each part of your query. To enable this feature just change/add the `"tracing": true` option in the GraphQL settings file. You can read more about the tracing feature from Apollo [here](https://www.apollographql.com/docs/engine/features/query-tracing.html).
You can edit these configurations in the following files.
**Path —** `./plugins/graphql/config/settings.json`.
......@@ -31,6 +33,7 @@ You can edit these configurations in the following files.
```
{
"endpoint": "/graphql",
"tracing": false,
"shadowCRUD": true,
"playgroundAlways": false,
"depthLimit": 7,
......
# Internationalization
See the [internationalization' concepts](../concepts/concepts.md#internationalization) for details.
See the [internationalization' concepts](../concepts/concepts.md#internationalization-and-localization) for details.
Because an API may need to send different data based on the language of the user, Strapi provides a built-in strategy to handle the internationalization (i18n).
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
{
"endpoint": "/graphql",
"tracing": false,
"shadowCRUD": true,
"playgroundAlways": false,
"depthLimit": 7,
......
......@@ -162,6 +162,7 @@ module.exports = strapi => {
context: ctx,
}),
validationRules: [depthLimit(strapi.plugins.graphql.config.depthLimit)],
tracing: _.get(strapi.plugins.graphql, 'config.tracing', false),
playground: false,
};
......
Copyright (c) 2018 Nikolay Tsenkov (nikolay@tsenkov.net).
Copyright (c) 2019 Nikolay Tsenkov (nikolay@tsenkov.net).
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Copyright (c) 2017, Vandium Software Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
Copyright (c) 2015-2018 Strapi Solutions.
Copyright (c) 2015-2019 Strapi Solutions.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
......@@ -16,7 +16,7 @@ module.exports = strapi => {
* Initialize the hook
*/
initialize: function(cb) {
initialize: function (cb) {
strapi.app.use(
async (ctx, next) => {
if (ctx.request.admin) {
......@@ -31,7 +31,17 @@ module.exports = strapi => {
})(ctx, next);
} else if (strapi.config.currentEnvironment.security.cors.enabled) {
return strapi.koaMiddlewares.kcors({
origin: strapi.config.middleware.settings.cors.origin,
origin: function (ctx) {
const whitelist = strapi.config.middleware.settings.cors.origin.split(/\s*,\s*/);
const requestOrigin = ctx.accept.headers.origin;
if (whitelist.includes('*')) {
return '*';
}
if (!whitelist.includes(requestOrigin)) {
return ctx.throw(`${requestOrigin} is not a valid origin`);
}
return requestOrigin;
},
exposeHeaders: strapi.config.middleware.settings.cors.expose,
maxAge: strapi.config.middleware.settings.cors.maxAge,
credentials: strapi.config.middleware.settings.cors.credentials,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册