首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apigee127:在本地运行模拟api时的问题

Apigee127:在本地运行模拟api时的问题
EN

Stack Overflow用户
提问于 2014-11-26 20:14:21
回答 1查看 88关注 0票数 0

我以以下方式编写了一个swagger文件:

代码语言:javascript
复制
swagger: "2.0"
info:
  version: "0.0.1"
  title: API Specification 116
# during dev, should point to your local machine
host: localhost
# basePath prefixes all resource paths 
basePath: /
# 
schemes:
  # tip: remove http to make production-grade
  - http
  - https
# format of bodies a client can send (Content-Type)
consumes:
  - application/json
# format of the responses to the client (Accepts)
produces:
  - application/json
x-a127-config: {}
x-volos-resources: {}
paths:
  /v1/customers/{customer_id}/summary :
  #/welcome:
    # binds a127 app logic to a route
    #x-swagger-router-controller: summary
    #x-volos-authorizations: {}
    #x-volos-apply: {}
    get:
      description: ""
      operationId: summary
      parameters:
        - name: customer_id
          in: path
          description: "The desired customer information"
          required: true
          type: "string"

      responses:
        "200":
          description: Success
          schema:
            # a pointer to a definition
            $ref: CustomerSummaryResponse
        # responses may fall through to errors
        default:
          description: Error
          schema:
            $ref: ErrorResponse
# complex objects have schema definitions
definitions:
  CustomerSummaryResponse:
    properties:
      id:
        type: string
      firstName:
        type: string
      middleName:
        type: string
      lastName:
        type: string
      email:
        type: string
      role:
        type: string
      tenure:
        type: string
      msidn: 
        type: string
      accountId:
        type: string
      addresses:
        type: object
        properties:
          type:
            type: string
          addressLine1:
            type: string
          addressLine2:
            type: string
          cityName:
            type: string
          stateCode:
            type: string
          zip:
            type: string
          zipExt:
            type: string
      accounts:
         type: object
         properties:
           id:
              type: string
           type:
              type: string
           category:
              type: string
           name: 
              type: string
           numberOfLines:
              type: number



  ErrorResponse:
    required:
      - message
    properties:
      message:
        type: string

在此之后,我想在我的机器上运行这个本地模拟程序,所以我做了a127项目start -m,然后我做了一个curl,即:

代码语言:javascript
复制
curl -i http://localhost:10010/v1/customer/12134/summary

我发现curl命令返回

代码语言:javascript
复制
C:\Apigee127>curl -i http://localhost:10010/welcome
curl: (7) Failed connect to localhost:10010; No error

我一开始以为港口有问题,但不确定有什么建议吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-26 23:45:17

试试这个:

代码语言:javascript
复制
curl -4 -i http://localhost:10010/v1/customer/12134/summary

它将迫使curl使用IPv4而不是IPv6。

史考特

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27158096

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档