openAPI - GradedJestRisk/js-training GitHub Wiki
List:
- on using $ref
- get APi URL on server.js
var app = require('express')();
app.get('/', function(req, res) {
res.json({message: 'Hello World!'});
})
app.listen(3000);
{
"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"
]
}
}
}