1.下載node.js並安裝。
安裝步驟:http://www.runoob.com/nodejs/nodejs-install-setup.html
2.安裝xmysql
進入命令窗口,輸入npm install -g xmysql
注:npm使用簡介見: https://www.runoob.com/nodejs/nodejs-npm.html
3.連接數據庫
輸入:xmysql -h localhost -u mysqlUsername -p mysqlPassword -d databaseName
注:xmysql -u mysql用戶名 -p mysql密碼 -o mysql端口號 -d 數據庫名
4.數據庫操作
postman中數據庫操作,如下圖所示爲查詢某張表並過濾出type類型爲1的數據。
相關操作詳見:https://github.com/o1lab/xmysql#xmysql--one-command-to-generate-rest-apis-for-any-mysql-database