All Projects → swagger-api → Swagger Node

swagger-api / Swagger Node

Licence: apache-2.0
Swagger module for node.js

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to Swagger Node

Swagger Core
Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
Stars: ✭ 6,898 (+76.1%)
Mutual labels:  rest-api, rest, swagger, openapi-specification, swagger-api
Swagger Js
Javascript library to connect to swagger-enabled APIs via browser or nodejs
Stars: ✭ 2,319 (-40.8%)
Mutual labels:  rest-api, rest, swagger, openapi-specification, swagger-api
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+443.25%)
Mutual labels:  rest-api, rest, swagger, openapi-specification, swagger-api
Swagger Codegen
swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Stars: ✭ 13,859 (+253.82%)
Mutual labels:  rest-api, rest, swagger, openapi-specification
Swagger Inflector
Stars: ✭ 131 (-96.66%)
Mutual labels:  rest-api, rest, swagger, openapi-specification
Drf Yasg
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
Stars: ✭ 2,523 (-35.59%)
Mutual labels:  rest-api, rest, swagger, openapi-specification
Swagger Editor
Swagger Editor
Stars: ✭ 7,365 (+88.03%)
Mutual labels:  rest-api, rest, swagger, openapi-specification
Swagger Parser
Swagger Spec to Java POJOs
Stars: ✭ 468 (-88.05%)
Mutual labels:  rest-api, rest, swagger, openapi-specification
Springdoc Openapi
Library for OpenAPI 3 with spring-boot
Stars: ✭ 1,113 (-71.59%)
Mutual labels:  rest-api, swagger, openapi-specification
Node Typescript Mongodb
node js typescript mongodb express generator yo
Stars: ✭ 96 (-97.55%)
Mutual labels:  rest-api, rest, swagger
Swagger Play
Stars: ✭ 320 (-91.83%)
Mutual labels:  rest, swagger, openapi-specification
Rest Hapi
🚀 A RESTful API generator for Node.js
Stars: ✭ 1,102 (-71.87%)
Mutual labels:  rest-api, rest, swagger
Openapi To Graphql
Translate APIs described by OpenAPI Specifications (OAS) into GraphQL
Stars: ✭ 973 (-75.16%)
Mutual labels:  rest-api, swagger, openapi-specification
Swagger Express Ts
Generate and serve swagger.json
Stars: ✭ 102 (-97.4%)
Mutual labels:  rest-api, rest, swagger
Go Codon
Workflow based REST framework code generator
Stars: ✭ 133 (-96.6%)
Mutual labels:  rest-api, rest, swagger
Gemini
Model Driven REST framework to automatically generate CRUD APIs
Stars: ✭ 138 (-96.48%)
Mutual labels:  rest-api, rest, swagger
Ssm
👅基于RESTful风格的前后端分离的SSM框架,集成了shiro和swagger等框架
Stars: ✭ 141 (-96.4%)
Mutual labels:  rest-api, rest, swagger
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (-11.97%)
Mutual labels:  rest-api, rest, swagger
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (-78.78%)
Mutual labels:  rest-api, swagger, openapi-specification
Proteus
Lean, mean, and incredibly fast JVM framework for web and microservice development.
Stars: ✭ 178 (-95.46%)
Mutual labels:  rest-api, rest, swagger

Build Status NPM version Dependency Status devDependency Status

The swagger module provides tools for designing and building Swagger-compliant APIs entirely in Node.js. It integrates with popular Node.js servers, including Express, Hapi, Restify, and Sails, as well as any Connect-based middleware. With swagger, you can specify, build, and test your API from the very beginning, on your laptop. It allows you to change and iterate your design without rewriting the logic of your implementation.

alt text

Remember, one great thing about this approach is that all of the Swagger validation logic is handled for you, and all of the routing logic is managed through the Swagger configuration. You don't have to code (or recode!) any of that stuff yourself.

Your swagger API in five steps

1. Install the swagger module

Install using npm. For complete instructions, see the install page.

$ npm install -g swagger

2. Create a new swagger project

Use the CLI to create and manage projects. Learn more on the quick start page.

$ swagger project create hello-world

3. Design your API in the Swagger Editor

The interactive, browser-based Swagger Editor is built in. It provides Swagger 2.0 validation and endpoint routing, generates docs on the fly, and consumes easy-to-read YAML.

$ swagger project edit

screenshot of project editor

4. Write controller code in Node.js

Code your API's business logic in Node.js.

function hello(req, res) {
    var name = req.swagger.params.name.value || 'stranger';
    var hello = util.format('Hello, %s!', name);
    res.json({ "message": hello });
}

If you look at the Swagger file in the editor (shown in step 3 above), the x-swagger-router-controller element (line 17 in the editor screenshot) specifies the name of the controller file associated with the /hello path. For example:

    paths:
        /hello:
            x-swagger-router-controller: hello_world

Controller source code is always placed in ./api/controllers. So, the controller source file for this project is ./api/controllers/hello_world.js.

The operationId element specifies which controller function to call. In this case (line 19), it is a function called hello. Learn more.

5. Run the server

Run the project server.

$ swagger project start

Now, call the API!

It just works!

$ curl http://127.0.0.1:10010/hello?name=Scott
{ "message": "Hello, Scott!" }

Installing the swagger module

See the Installing swagger for details.

Using the swagger module

Go to the swagger module doc page. It includes all the information you need to get started.

About this project

This initiative grew out of Apigee-127, an API design-first development framework using Swagger. Apigee donated the code to create the swagger-node project in 2015.

Copyright 2016 Apigee Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].