Welcome to Port

More Easily Create an API Servers, designed to streamline the deployment of APIs for developers. With this tool, developers can effortlessly deploy APIs and integrate various applications to build a unified web service. Port Application simplifies the process, enabling developers to focus on creating seamless and efficient solutions with ease.

Please see the documentation lincense

The Requirements


Download URL


VERSION OS STABLE URL
v1.0.20 Windows x64 No v1.0.20-win-installer

Repository


To deploy APIs, you must first store the API definitions in the repository before proceeding with the deployment. Please refer to the instructions below for guidance on storing and deploying your APIs after saving them to the repository.

Creates a repository

port new [repository-name]

Layout

port.toml         # The configuration file.
.enum             # The custom enum file 
API-A-Group/      # The group directory. 
    sample1.msg   # The message file
    sample2.msg   # The message file
    sample3.msg   # The message file

API-B-Group/      # The group directory. 
    sample1.msg   # The message file
    sample2.msg   # The message file
    sample3.msg   # The message file
...               # Other files.

Tip

The repository name cannot contain special characters. It follows the directory naming rules provided by the operating system.


Creates a API-Groups

port add [group-name]

Message (*.msg)

A message is an object that allows users to specify API properties in a pre-provided Application Service. The message is a kv, and types and properties can be defined in that message. Please attach the materials attached below.


message attribute

name description
api Real-time synchronization and messaging are handled within the corresponding external library. For more details, please refer to the api documentation.
backup Changes are saved to the backup database as they occur, ensuring that values are restored upon application restart. and values are not propagated api messages during program execution.
property Can specify a custom property
rule Can specify rules to manage the values of corresponding messages.

sample1.msg

 DevAPowerStatus    enum.DeviceAStatus  api:DeviceA.GetStatus         
 DevAErrorMessage   text                api:DeviceA.GetErrorMessage property:{"Arguments":"1,0"}
 DevCTemperature    num                 api:DeviceC.GetTemperature property:{"MIN":0,"MAX":300}
 DevCOnOff          enum.OnOff          api:DeviceC.OnOff           
 ...

Tip

message document do not using special characters.

Enum (*.enum)


Enums are particularly useful when you have a fixed set of values that a variable can take, such as days of the week, months of the year, or status codes. They help make your code more expressive, self-documenting, and less error-prone because you're working with named constants instead of raw integer values.

custom.enum

TFalse      True:0      False:1
FTrue       False:0     True:1

Commands


Repository

Tip

The application runs based on the values stored in the repository. The push action must precede the application startup. Subsequently, users can perform a pull action at any desired moment to restore the repository.

Application

Tip

port application must be start portlib services application

Message

port set groupA sayHelloMessage1 Hello?
[set-ok]
port get groupA sayHelloMessage1
[Hello?]