Generating a Server Stub

With API Hub for Design, you can easily generate a server stub (an API implementation stub) for Node.js, ASP.NET, JAX-RS, and other servers and frameworks. The server stub is a good starting point for implementing your API – you can run and test it locally, implement the business logic for your API, and then deploy it to your server.

Anyone can generate a server stub for any API in API Hub for Design, unless the API owner disabled server generation in the code generation options.Code Generation Options

Downloading a server stub

  1. Open the API page in API Hub for Design.

  2. If the API has several versions, select the version, for which you want to generate the code.

    API_screenshot_API_versions_01.png
  3. From the Export menu, select Server Stub, and then the desired language or framework.

    Note

    Languages marked with an asterisk * use custom code generation options as configured by the API editors.

    Generating an API server stub
  4. Download and unzip the server code.

Code generation options

API owners can customize the code generation options for their APIs.Code Generation Options

Custom server generators

API Hub for Design On-Premise allows companies to create and use custom code generators. To learn more, see Using Custom Codegen TemplatesUse Custom Codegen Templates.

I have downloaded the server stub. Now what?

You can run and test the generated server locally. Note that the generated API code contains just stub methods that do not contain any actual programming logic. You need to implement the logic yourself to handle whatever work the API needs to do. Once the implementation is ready, you can deploy the API locally or on your server. See the README.md file in the downloaded archive to get started.

See Also

Publication date: