一、准备环境,安装nodejs和xmysql
1、安装nodejs
2、安装xmysql
二、postman对接mysql
1、启动xmysql服务
xmysql -h host_name -u user_name -p user_password -d database_name
2、postman连接数据库
启动xmysql后,即可通过http://localhost:3000/api/ 访问 xmysql 自动生成的 Rest API,详细的使用方法可通过https://github.com/o1lab/xmysql查看
备注:localhost是mysql服务要启动的机器的ip,3000是xmysql服务默认端口,可在启动时通过-r修改
postman输入接口http://localhost:3000/api/表名?条件,访问成功,如图