Skip to content

A module that serves swagge-editor and swagger-ui backend

Notifications You must be signed in to change notification settings

sharonx/serve-swagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inspired by: https://github.com/moander/serve-swagger-editor. Added swagger-ui for hosting too.

Main Feature

  • To allow the Swagger Editor to save the API spec file to the backend (using PUT) instead of using client-side localstorage.
  • The Swagger UI can read the same spec file and render the UI in real time.

Sample Server Code

var http = require('http');
var serveSwagger = require('./serve-swagger'); 

var app = serveSwagger({
  disableNewUserIntro: true,
  useBackendForStorage: true,
  useYamlBackend: true
}, './tmp/myspec.yaml');

var server = http.createServer(app);

server.on('request', function (req, res) {

  res.on('finish', function () {
    console.log(res.statusCode, req.method, req.originalUrl);     
  });
});

server.listen(8080, function () {
  console.log(server.address());
});

With above code, you should be able to access

About

A module that serves swagge-editor and swagger-ui backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published