-
Notifications
You must be signed in to change notification settings - Fork 10
docs(install): split installation doc in multiple sections #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
77aae90
docs(install): split installation doc in multiple sections
jeffladiray 21f999e
docs(quickstart): update the quickstart doc
jeffladiray fdd5d94
docs: fix docs
jeffladiray d77005b
docs: fix docs
jeffladiray 509d708
docs: fix docs
jeffladiray a53e835
docs: fix docs
jeffladiray a900ac7
docs: fix docs by adding cors config infos
jeffladiray d7b9534
docs: fix doc
jeffladiray ea668cb
docs: fix doc
jeffladiray 716373b
docs(datasources): document how to add multiple data sources (#363)
Scra3 4f4b15b
docs: fix doc
jeffladiray 09ccedf
fix: fix doc
jeffladiray d23f538
fix: fix doc
jeffladiray 617f913
fix: spellcheck and review fixes
jeffladiray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| You can plug as many data sources as you want, no matter its type. | ||
| For example, you can plug a [Mongoose data source](../provided/mongoose.md) with a [SQL data source](../provided/sql.md). We take care of the compatibility for you. | ||
|
|
||
| ```javascript | ||
| const { createAgent } = require('@forestadmin/agent'); | ||
| const { createSqlDataSource } = require('@forestadmin/datasource-sql'); | ||
| const { createMongooseDataSource } = require('@forestadmin/datasource-mongoose'); | ||
| // Mongoose connection with its model declarations. | ||
| const connection = require('./mongoose-models'); | ||
|
|
||
| // Instantiate data sources. | ||
| const sqlDataSource = createSqlDataSource('postgres://user:pass@localhost:5432/mySchema'); | ||
| const mongooseDataSource = createMongooseDataSource(connection); | ||
|
|
||
| // Plug every created data sources to the agent. | ||
| const agent = createAgent(options).addDataSource(sqlDataSource).addDataSource(mongooseDataSource); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| When importing collections to an admin panel, you may encounter naming collisions. | ||
|
|
||
| You can tackle them by renaming the collection that are causing issues. | ||
|
|
||
| Don't worry if you leave naming collisions, your development agent will warn you while starting. | ||
|
|
||
| ```javascript | ||
| const { createAgent } = require('@forestadmin/agent'); | ||
| const { createSqlDataSource } = require('@forestadmin/datasource-sql'); | ||
|
|
||
| const agent = createAgent(options); | ||
| const sqlDataSource = new createSqlDataSource('postgres://user:pass@localhost:5432/mySchema'); | ||
|
|
||
| // Rename sqlDataSource collections by providing replacements | ||
| agent.addDataSource(sqlDataSource, { | ||
| // In this example, it will rename the `customers` and `stores` collections | ||
| // to `superCustomers` and `superStores`. | ||
| rename: { | ||
| customers: 'superCustomers', | ||
| stores: 'superStores', | ||
| }, | ||
| }); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| The relation mechanism allows you to add a relation between different data sources, regardless of their type. | ||
| It is a very powerful feature to link your different data sources. | ||
|
|
||
| ```javascript | ||
| const { createAgent } = require('@forestadmin/agent'); | ||
| const { createSqlDataSource } = require('@forestadmin/datasource-sql'); | ||
| const { createMongooseDataSource } = require('@forestadmin/datasource-mongoose'); | ||
|
|
||
| // Mongoose connection with its model declarations. | ||
| const connection = require('./mongoose-models'); | ||
|
|
||
| // Instanciate data sources. | ||
| const sqlDataSource = createSqlDataSource('postgres://user:pass@localhost:5432/mySchema'); | ||
| const mongooseDataSource = createMongooseDataSource(connection); | ||
|
|
||
| // Plug every created data sources to the agent. | ||
| const agent = createAgent(options).addDataSource(sqlDataSource).addDataSource(mongooseDataSource); | ||
|
|
||
| // Add a relation between a Mongoose collection and a SQL collection. | ||
| agent.customizeCollection('countryFromMongoose', collection => | ||
| collection.addOneToManyRelation('towns', 'townsFromSQL', { | ||
| originKey: 'country_id', | ||
| }), | ||
| ); | ||
| ``` | ||
|
|
||
| {% hint style="info" %} | ||
| If you want to know more about adding relation, please refer to this [section](../custom/query-translation/relationships.md). | ||
| {% endhint %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.