Coder Social home page Coder Social logo

alibaba / tac Goto Github PK

View Code? Open in Web Editor NEW
280.0 28.0 54.0 8.11 MB

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.

License: MIT License

JavaScript 4.55% HTML 0.16% Vue 5.55% CSS 0.02% Java 89.72%
tangram tac micro-service

tac's Introduction

TAC

What is TAC ?

  • 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.

Features

  • Quick publish;
  • Without deploy;
  • Flexible modification
  • Quickly add data sources
  • Client developers directly participate in server-side logic;

Why TAC?

Before TAC

  • Before the birth of TAC, the development mode of most app server-side on Tmall app was like this. Take the home page as an example:
    • Client and server developer discuss the interface data types, fields;
    • The server developer provides a mock interface with parallel development at both ends.
    • Test, deploy, release.
  • The disadvantage of this model is that since the page relies on various data sources, publishing is a long process. If the field is modified, the entire application will be recompiled and packaged. The deployment process is too long; different pages are deployed in different applications. unable to share data source

After TAC

  • TAC access to various commonly used data sources;
  • Clients submit source code directly on TAC, compile, test, and publish;
  • Client development does not require the participation of server-side developer, eliminating the need for communication.
  • Server-side developer focus on developing business logic;

tac develop progress

Quick Start

Install redis

Run container

java -jar tac-container.jar

Run console

java -jar tac-console.jar --admin
  • open console when succes
http://localhost:7001/#/tacMs/list

Code Develop

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>tac-sdk</artifactId>
            <version>${project.version}</version>
        </dependency>
  • Write your code
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);
    }
}

compile and package

cd tac-dev-source
java -jar tac-console.jar --package --msCode=helloworld

Pre-Publish

  • Pre-Publish

  • Test-Pre-Publish

Online-Publish

  • online check
curl  http://localhost:8001/api/tac/execute/helloworld -s|json
  • Result
{
  "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"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.