Skip to content

Instantly share code, notes, and snippets.

@giisyu
Last active December 10, 2016 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giisyu/ff4c5bf7637ff8d2e431d1c900fe6ab7 to your computer and use it in GitHub Desktop.
Save giisyu/ff4c5bf7637ff8d2e431d1c900fe6ab7 to your computer and use it in GitHub Desktop.
npm install -g swagger
swagger project create my-project
swagger project generate-test
swagger project test
swagger project test
cd hello-world
# binds a127 app logic to a route
x-swagger-router-controller: hello_world
swagger project start my-project
curl http://127.0.0.1:10010/hello?name=Scott
swaggerExpress.register(app);
var port = process.env.PORT || 10010;
app.use(swaggerExpress.runner.swaggerTools.swaggerUi()); //追記
app.listen(port);
swagger project edit my-project
# binds a127 app logic to a route
x-swagger-router-controller: hello_world
...
/task:
x-swagger-router-controller: hello_world
get:
description: task api
operationId: task
responses:
"200":
description: success
schema:
type: "object"
properties:
id:
type: "integer"
format: "int64"
task:
type: "string"
swagger project start -m
...
/task:
x-swagger-router-controller: hello_world
get:
description: task api
operationId: task
responses:
"200":
description: success
schema:
type: "object"
properties:
id:
type: "integer"
format: "int64"
task:
type: "string"
{
"id": 1,
"task": "Sample text"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment