簡體   English   中英

Apigee127:在本地運行模擬api時出現問題

[英]Apigee127: Issue in running a mock api locally

我以以下方式編寫了一個大張揚的文件:

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:

curl -i http://localhost:10010/v1/customer/12134/summary

我發現curl命令返回

C:\Apigee127>curl -i http://localhost:10010/welcome
curl: (7) Failed connect to localhost:10010; No error

我最初以為端口可能有問題,但不確定是否有任何建議?

嘗試這個:

curl -4 -i http://localhost:10010/v1/customer/12134/summary

它將強制curl使用IPv4而不是IPv6。

斯科特

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM