I believe that when you use api management tools, you will have the same question: I have two sets of data sources, how to implement the corresponding deployment? After reading this article, you will have a general understanding of how to implement your own planned deployment method based on data sources .
Take our Eoapi as an example, Eoapi will provide two sets of data sources:
- Local data source: stand-alone/offline use, IndexedDB database
- Remote data source: remote collaboration, Node.js+MySQL
Server deployment
Install the database <br>Install MySQL, then start MySQL and create a database named Eoapi.
mysql -u root -p
create DATABASE eoapi;
Service deployment
1. Clone repository on the server
git clone https://github.com/eolinker/eoapi-remote-server
2. After deploying according to the README, configure the ormconfig.json file
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "root",
"password": "xxxxxx",//数据库密码
"database": "eoapi",//数据库名称
"synchronize": false,
"logging": false,
"entities": ["dist/entities/**/*.js"],
"migrations": ["dist/migrations/**/*.js"],
"migrationsRun": true,
"cli": {
"migrationsDir": "src/migrations"
}
}
3. To configure .env to access remote services, you need to add token authentication, the format is API_KEY=xxx
API_KEY=1ab2c3d4e5f61ab2c3d4e5f6
4. To start the service for the first time, you need to install dependencies
npm install
Startup project
npm start
As shown in the figure, the project started successfully
Service upgrade
After shutting down the service, run the migration script and restart the service.
npm run migration:run
Client configuration
Click Configure, fill in the server address and Token, and you can collaborate remotely to use the remote data source.
Eoapi is an open source API management tool. It is more portable and extensible, and meets the core needs of developers for APIs. In addition to including interface testing and interface documentation functions, there are more common functions .
If you have good suggestions or feedback on our Eoapi , I hope you can also find us on Github and raise an Issue, we will really pay attention and reply in time~
☛ Github: https://github.com/eolinker/eoapi
☛ Development documentation: https://docs.eoapi.io/?utm_source=SF080302
☛ Online demo: https://demo.eoapi.io/zh
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。