background
Home / Portfolio / Postman Collection Documentation
PORTFOLIO

Postman Collection Documentation

Challenge Binar Academy Kampus Merdeka Batch 3 - Chapter 5. Generate documentation from Postman collection.

#Postman  #Documentation  #Binar Challenge  

Postman Collection Documentation

Generate documentation from Postman collection. This project is a simple to generate documentation from Postman collection.

Binar Challenge - Backend JavaScript - Chapter 5

This project is one of Challenge from Binar Academy Kampus Merdeka. The challenge is to build a simple documentation generator from Postman collection.

This challenge is a continuation of the previous challenge, which is RESTful API with ExpressJS.

Online Postman Collection Documentation : Click here

Source code : GitHub / GitLab

Requirements

  • Generate documentation from Postman collection

Features

  • User Game CRUD
  • User Game Biodata CRUD
  • User Game History CRUD
  • Authentication
  • Generate documentation from Postman collection

Tech Stack

Tools

Prerequisites

  • NodeJS
  • PostgreSQL
  • sequelize-cli - Sequelize command line interface, make sure you install it globally.
  • nodemon - Nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application. Make sure you install it globally.

Installation and Usage

Clone the repository

1git clone https://github.com/raprmdn/binar-challenge.git
bash

Cd into the project directory

1cd binar-challenge/chapter5
bash

Install dependencies

1npm install
bash

Generate Postman Collection Documentation

1npm run generate:collection
bash
Import file collection.json from the root directory to Postman and run the collection to see the result

Implementation

Generate the collection documentation using postman-collection package.

postmanCollection.utils.js
1const { Collection } = require('postman-collection'); 2const fs = require('fs'); 3const { authGroup, charactersGroup, historiesGroup } = require('../helpers/collection/request.collection'); 4 5const postmanCollection = new Collection({ 6 info: { 7 name: 'Binar Challenge - ExpressJS RESTful API CRUD - Postman Collection - Chapter 5', 8 version: '1.0.0', 9 description: 'Postman Collection API Documentation', 10 }, 11 item: [ 12 authGroup, 13 charactersGroup, 14 historiesGroup 15 ] 16}); 17 18const collectionJSON = postmanCollection.toJSON(); 19 20fs.writeFile('./collection.json', JSON.stringify(collectionJSON, null, 2), (err) => { 21 if (err) { console.log(err); } 22 console.log('Collection generated successfully.'); 23});
javascript

The code above will generate a file named collection.json in the root directory.

Then the collection.json can be imported to Postman.

Next Challenge

The next challenge is create Unit Test and Integration Test using Jest and Supertest. Check it out here.