Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Outline

APIJSON后端部署 - Java

用现成的开箱即用 jar包 极速部署 见

https://github.com/TommyLemon/StaticResources/tree/master/APIJSONServer

1.下载后解压APIJSON工程

打开APIJSON的GitHub主页 > Clone or download > Download ZIP > 解压到一个路径并记住这个路径。


2.用Eclipse for JavaEE或IntellIJ IDEA Ultimate运行后端工程

如果以上编辑器一个都没安装,运行前先下载安装一个。
我的配置是Windows 7 + JDK 1.7.0_71 + Eclipse 4.6.1 + IntellIJ 2016.3 和 OSX EI Capitan + JDK 1.8.0_91 + Eclipse 4.6.1 + IntellIJ 2016.2.5

Eclipse for JavaEE

1)打开
顶部菜单File > Import > Maven > Existing Maven Projects > Next > Browse
> 选择刚才解压路径下的APIJSON-Master/APIJSON-Java-Server/APIJSONDemo
> 勾选 /pom.xml ... apijson-demo > Finish
2)Demo依赖Library
右键libs里面的 apijson-server.jar > Build Path > Add to Build Path
3)配置(如果完成下方步骤4,导入APIJSON的表,则可跳过)
打开 apijson.demo.server.DemoSQLConfig 类,编辑 getDBUri,getDBAccount,getDBPassword,getSchema 的返回值为你自己数据库的配置。
4)运行
顶部菜单Run > Run As > Java Application > 选择APIJSONApplication > OK

IntellIJ IDEA Ultimate

1)打开
Open > 选择刚才解压路径下的APIJSON-Master/APIJSON-Java-Server/APIJSONDemo > OK
2)Demo依赖Library
右键libs里面的 apijson-server.jar > Add as Library > OK
3)配置(如果完成下方步骤4,导入APIJSON的表,则可跳过)
打开 apijson.demo.server.DemoSQLConfig 类,编辑 getDBUri,getDBAccount,getDBPassword,getSchema 的返回值为你自己数据库的配置。
4)运行
顶部菜单Run > Run > Edit Configurations > + > Application > Configuration
> Main class 选APIJSONApplication
> Use classpath of module 选apijson-demo
> 最后在底部 Run

运行后会出现 APIJSON的测试日志,最后显示 "APIJSON已启动" ,说明已启动完成。

如果是Address already in use,说明8080端口被占用,
可以关闭占用这个端口的程序(可能就是已运行的APIJSON工程)
或者 改下APIJSON工程的端口号,参考 SpringBoot改端口
其它问题请谷歌或百度。


3.测试连接

在浏览器输入 http://localhost:8080/get/{}
如果出现

{
  "code": 200,
  "msg": "success"
}

则说明已连接上。

如果是404 Not Found,请把防火墙关闭,以便外网能够访问你的电脑或服务器。
其它问题请谷歌或百度。


4.导入表文件到数据库

可以先跳过,用Table, Column或者其它 你自己数据库中已有的表 来测试。

后端需要MySQL Server和MySQLWorkbench,没有安装的都先下载安装一个。
我的配置是Windows 7 + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.7 和 OSX EI Capitan + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.8 + Postgre 2.1.5,其中系统和软件都是64位的。

使用 Navicat

启动Navicat > 双击 localhost > 双击 postgres > 右键 postgres >
如果没有 sys 模式则先右键新建一个 > 运行 SQL 文件 > 根据你使用的数据库类型来选择刚才解压路径下的 APIJSON-Master/MySQL 和 APIJSON-Master/PostgreSQL
> 开始 > 右键 postgres 里的 sys > 刷新, sys/表 会出现添加的表。

使用 MySQLWorkbench(仅限MySQL)

启动MySQLWorkbench > 进入一个Connection > 如果没有 sys Schema则先右键新建一个 > 点击Server菜单 > Data Import > 选择刚才解压路径下的APIJSON-Master/MySQL > Start Import > 刷新SCHEMAS, 左下方 sys/tables 会出现添加的表。

配置你自己的表请参考: 3步创建APIJSON后端新表及配置


5.测试接口

直接使用 APIJSON在线工具 或 下载主页提供的 客户端App


Morty Proxy This is a proxified and sanitized view of the page, visit original site.