openAPI - GradedJestRisk/js-training GitHub Wiki

Table of Contents

General

List:

Samples

JSON

Pet

v2

Hello, World

application (app.js)

var app = require('express')();

app.get('/', function(req, res) {
  res.json({message: 'Hello World!'});
})

app.listen(3000);

description (api_description.json)

{
	"swagger": "2.0",
	"info": {
		"version": "1.0",
		"title": "Example API",
		"license": {
			"name": "MIT"
		}
	},
	"host": "www.example.com",
	"basePath": "/",
	"schemes": [
		"http"
	],
	"paths": {
		"/": {
			"get": {
				"produces": [
					"application/json; charset=utf-8"
				],
				"responses": {
					"200": {
						"description": "",
						"schema": {
							"$ref": "#/definitions/response"
						}
					}
				}
			}
		}
	},
	"definitions": {
		"response" : {
			"type": "object",
			"properties": {
				"message": {
					"type": "string"
				}
			},
			"required": [
				"message"
			]
		}
	}
}
⚠️ **GitHub.com Fallback** ⚠️