This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app.js | |
'use strict'; | |
const express = require('express'); | |
const mongoose = require('mongoose'); | |
const path = require('path'); | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swagger.json | |
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Example API", | |
"version": "1.0.0" | |
}, | |
"host": "localhost:3000", | |
"basePath": "/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app.js | |
'use strict'; | |
// initialize an express app | |
const express = require('express'); | |
const mongoose = require('mongoose'); | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is an example a JSON Swagger Spec | |
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Uber API", | |
"description": "Move your app forward with the Uber API", | |
"version": "1.0.0" | |
}, | |
"basePath": "/v1", | |
"produces": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is an example a YAML Swagger Spec | |
swagger: '2.0' | |
info: | |
title: Uber API | |
description: Move your app forward with the Uber API | |
version: "1.0.0" | |
basePath: /v1 | |
produces: | |
- application/json | |
paths: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require('express')(); | |
const doctopus = require('doctopus'); | |
const docs = new doctopus.DocBuilder(); | |
const docFactory = new doctopus.Doc(); | |
docs.set('title', 'My Express App'); | |
docs.add('/swagger', docFactory.get() | |
.group('Documentation') | |
.description('Gets a Swagger Specification') |