Skip to content

Instantly share code, notes, and snippets.

// app.js
'use strict';
const express = require('express');
const mongoose = require('mongoose');
const path = require('path');
const app = express();
// swagger.json
{
"swagger": "2.0",
"info": {
"title": "Example API",
"version": "1.0.0"
},
"host": "localhost:3000",
"basePath": "/",
// app.js
'use strict';
// initialize an express app
const express = require('express');
const mongoose = require('mongoose');
const app = express();
// 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 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:
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')