Explore and prototype microservices with Postman and Hivepod

Companies across the world are rapidly adopting Microservices Architectures as part of their Digital Transformation. Amazon, Netflix or eBay have proven the value of this new pattern which enabled them to innovate at scale with a high degree of agility and resilience.

Free from the constraints of monolithic architectures, developers are becoming an integral part of rapid innovation processes. Digital innovations require the highest levels of productivity in terms of designing, building, testing and deploying software and in particular Microservices.

Postman and Hivepod have created a powerful integration that accelerates the delivery workflow.

postman-hivepod-workflow

With Hivepod a developer can create Microservices on the MEAN stack (MongoDB, ExpressJS, AngularJS, NodeJS) in a very short time, simply by specifying a relational data model.

Hivepod, then, generates the MEAN code and deploys it to your favorite cloud provider (you can deploy it to your computer as well). In addition, Hivepod generates a complete Postman Collection which can be handed to the API clients to explore and test the APIs.

Postman is the preferred API development tool for developers with more than 2 million users and more than 5000 downloads per day.

Postman lets developers send requests and analyze responses quickly. Developers can also organize requests in collections, write documentation for these requests and a lot more. Postman has a robust testing framework that allows developers to write API tests using a combination of the GUI and Javascript. Postman’s visual interface helps developers debug these tests and uncover bugs efficiently. The same tests can be run using a command line and as part of a build pipeline using newman – Postman’s command line companion tool.

Let’s build a Microservice!
The following steps should take about 5 minutes:

  1. Log into https://hivepod.io with a social network or create a local account
  2. Create a new project in Hivepod
  3. We will use the following model in this sample, but you can modify it as you wish:
class User
{
    string Name;
    string Handle;
    int? Age;
    bool IsActive;
    Tweet* Tweets <-->Author;
}
class Tweet
{
    string Message;
    string Link;
    User* Retweets;
    User* Favs;
}
  1. Press Publish, select a deployment method (Heroku sandbox is the easiest one when you use the product for the first time: no account is needed) and then Go
  2. In seconds the code generation is completed and you can download a ZIP file with the full project. To run it locally you simply need the following dependencies installed:
    a. MongoDB 3.0
    b. NodeJS >= 4.x

And then (you will need at least 1 Gb of RAM to install the Microservice’s stack):


$ npm install
$ npm start

Screenshot 2015-11-23 13.28.41

  1. In 3-4 minutes you should have your backend deployed into the cloud. A url with the deployment server will be provided at the end of the deployment.

Screenshot 2015-11-23 13.29.34

  1. You can login at such URL with the default credentials (user/password): (admin/icinetic)

Screenshot 2015-11-23 13.29.47

  1. In the source files ZIP, inside the folder /api-invocation-samples/postman you will find two artifacts ready to use:
    a. A Postman collection collection.json.postman_collection
    b. A Postman environment file env0.postman_environment

Let’s Test it with Postman

Now you can import this two files directly into Postman and start exploring your new Microservice.

The collection is organized by resources. All operations for a given resource will appear grouped together. The environment file contains parametrization about the base URL plus credentials:

Screenshot 2015-11-23 13.29.58

host The hostname of the service. e.g.: myservice.cloudprovider.com
port The port to use. Defaults to 80.
user The username for authentication. Default: admin
pass The password for authentication. Default: icinetic

The generated Postman collection contains sample class for each resource to make it easy to explore the UI and test the operations. Query, Create, Update, Delete are supported.

Advanced scenarios for queries are also available in the BaucisJS documentation including pagination, filtering, ordering, populate and grouping.

The backend supports different methods for authentication: including Basic Auth & API Key.

Hivepod also support relations between the resources (see doc).

Conclusion

Providing Postman collections helps client developers quickly understand the microservices’ API with a familiar tool and allows them to generate samples in different technologies (like iOS, Android, C# or Java) to integrate with the API in minutes.

Now is time for you to customize your backend and deploy it!

Hivepod + Postman integration short video: https://vimeo.com/146616388

What do you think about this topic? Tell us in a comment below.

Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 thought on “Explore and prototype microservices with Postman and Hivepod

    The site hivepod is unavailable now. Are any updates planned for this blog/tutorial?

    Thanks