0
私はすごく斬新です。私はいくつかの例をテストするためにOnline Swagger Editorを使用したいと思います。しかし、私はイメージ[ enter image description here]として問題を抱えていました。swaggerのレスポンススキーマのコードがnode.jsのレスポンスステータスコードとどのように一致しますか?
次が闊歩エディタで私のデザインで次のように
swagger: '2.0'
info:
version: 1.0.0
title: API example
description: An API example to pratice.
schemes:
- https
- http
host: '127.0.0.1:3000'
basePath: /users
paths:
/connect:
get:
summary: get some infos!
description: get some info!
responses:
'200':
description: haha success!
'404':
description: not found!
default:
description: error!!!!
そして、私のNode.jsのコードは以下のとおりです。
var express = require('express');
var router = express.Router();
/* GET users listing. */
router.get('/connect', function(req, res, next) {
console.log("111");
res.send('200');
});
module.exports = router;
私はNode.jsのが返す方法がわかりません'200'や '404'のようなコードです。
誰かがそれを処理できますか?私の質問に答えてくれてありがとう! YAMLフォーマットでnodejsで
はい、それはそれです!どうもありがとう! – qitian