The TAC (Tiny API Cloud) is a server-side solution with tangram. Of course, it also supports the use of secession from tangram; TAC is not a platform, nor a framework, but a development model.
java -jar tac-container.jar
java -jar tac-console.jar --admin
http://localhost:7001/#/tacMs/list
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>tac-sdk</artifactId>
<version>${project.version}</version>
</dependency>
public class HelloWorldTac implements TacHandler<Object> {
/**
* 引入日志服务
*/
private TacLogger tacLogger = TacInfrasFactory.getLogger();
/**
* 编写一个实现TacHandler接口的类
*
* @param context
* @return
* @throws Exception
*/
@Override
public TacResult<Object> execute(Context context) throws Exception {
// 执行逻辑
tacLogger.info("Hello World");
Map<String, Object> data = new HashMap<>();
data.put("name", "hellotac");
data.put("platform", "iPhone");
data.put("clientVersion", "7.0.2");
data.put("userName", "tac-userName");
return TacResult.newResult(data);
}
}
cd tac-dev-source
java -jar tac-console.jar --package --msCode=helloworld
Pre-Publish
Test-Pre-Publish
curl http://localhost:8001/api/tac/execute/helloworld -s|json
{
"success": true,
"msgCode": null,
"msgInfo": null,
"data": {
"helloworld": {
"data": {
"name": "hellotac",
"clientVersion": "7.0.2",
"userName": "tac-userName",
"platform": "iPhone"
},
"success": true,
"msCode": "helloworld"
}
},
"hasMore": null,
"ip": "127.0.0.1"
}