You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
8
9
9
10

10
11
11
-
12
12
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.
13
13
14
-
# Your swagger API in five steps
14
+
##Your swagger API in five steps
15
15
16
-
## 1. Install the swagger module
16
+
###1. Install the swagger module
17
17
18
18
Install using npm. For complete instructions, see the [install](./docs/install.md) page.
19
19
20
20
```bash
21
-
$ npm install -g swagger
21
+
npm install -g swagger
22
22
```
23
23
24
-
## 2. Create a new swagger project
24
+
###2. Create a new swagger project
25
25
26
26
Use the [CLI](./docs/cli.md) to create and manage projects. Learn more on the [quick start](./docs/quick-start.md) page.
27
27
28
28
```bash
29
-
$ swagger project create hello-world
29
+
swagger project create hello-world
30
30
```
31
31
32
-
## 3. Design your API in the Swagger Editor
32
+
###3. Design your API in the Swagger Editor
33
33
34
34
The interactive, browser-based [Swagger Editor](http://editor.swagger.io/) is built in. It provides Swagger 2.0 validation and endpoint routing, generates docs on the fly, and consumes easy-to-read YAML.
35
35
36
36
```bash
37
-
$ swagger project edit
37
+
swagger project edit
38
38
```
39
39
40
40

41
41
42
-
## 4. Write controller code in Node.js
42
+
###4. Write controller code in Node.js
43
43
44
44
Code your API's business logic in Node.js.
45
45
@@ -63,15 +63,15 @@ Controller source code is always placed in `./api/controllers`. So, the controll
63
63
64
64
The `operationId` element specifies which controller function to call. In this case (line 19), it is a function called `hello`. Learn [more](./docs/controllers.md).
0 commit comments