update nodejs express server samples

This commit is contained in:
William Cheng 2025-02-22 23:15:00 +08:00
parent f83b049fe6
commit cea3c5ba09
6 changed files with 50 additions and 25 deletions

View File

@ -1,7 +1,7 @@
// Use this file as a starting point for your project's .eslintrc. // Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed. // Copy this file, and add rule overrides as needed.
{ {
"extends": "airbnb", "extends": "airbnb-base",
"rules": { "rules": {
"no-console": "off" "no-console": "off"
} }

View File

@ -0,0 +1,19 @@
.eslintrc.json
README.md
api/openapi.yaml
config.js
controllers/Controller.js
controllers/PetController.js
controllers/StoreController.js
controllers/UserController.js
controllers/index.js
expressServer.js
index.js
logger.js
package.json
services/PetService.js
services/Service.js
services/StoreService.js
services/UserService.js
services/index.js
utils/openapiRouter.js

View File

@ -1 +1 @@
5.0.0-SNAPSHOT 7.12.0-SNAPSHOT

View File

@ -1,7 +1,7 @@
openapi: 3.0.1 openapi: 3.0.1
info: info:
description: This is a sample server Petstore server. For this sample, you can use description: "This is a sample server Petstore server. For this sample, you can\
the api key `special-key` to test the authorization filters. \ use the api key `special-key` to test the authorization filters."
license: license:
name: Apache-2.0 name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html url: https://www.apache.org/licenses/LICENSE-2.0.html
@ -122,8 +122,8 @@ paths:
/pet/findByTags: /pet/findByTags:
get: get:
deprecated: true deprecated: true
description: Multiple tags can be provided with comma separated strings. Use description: "Multiple tags can be provided with comma separated strings. Use\
tag1, tag2, tag3 for testing. \ tag1, tag2, tag3 for testing."
operationId: findPetsByTags operationId: findPetsByTags
parameters: parameters:
- description: Tags to filter by - description: Tags to filter by
@ -235,13 +235,7 @@ paths:
content: content:
application/x-www-form-urlencoded: application/x-www-form-urlencoded:
schema: schema:
properties: $ref: '#/components/schemas/updatePetWithForm_request'
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
responses: responses:
"405": "405":
content: {} content: {}
@ -269,14 +263,7 @@ paths:
content: content:
multipart/form-data: multipart/form-data:
schema: schema:
properties: $ref: '#/components/schemas/uploadFile_request'
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
format: binary
type: string
responses: responses:
"200": "200":
content: content:
@ -767,6 +754,25 @@ components:
type: string type: string
title: An uploaded response title: An uploaded response
type: object type: object
updatePetWithForm_request:
properties:
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
type: object
uploadFile_request:
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
format: binary
type: string
type: object
securitySchemes: securitySchemes:
petstore_auth: petstore_auth:
flows: flows:
@ -780,3 +786,4 @@ components:
in: header in: header
name: api_key name: api_key
type: apiKey type: apiKey
x-original-swagger-version: "2.0"

View File

@ -2,9 +2,9 @@ const path = require('path');
const config = { const config = {
ROOT_DIR: __dirname, ROOT_DIR: __dirname,
URL_PORT: 3000, URL_PORT: 8080,
URL_PATH: 'http://localhost', URL_PATH: 'http://petstore.swagger.io',
BASE_VERSION: 'v2', BASE_VERSION: '/v2',
CONTROLLER_DIRECTORY: path.join(__dirname, 'controllers'), CONTROLLER_DIRECTORY: path.join(__dirname, 'controllers'),
PROJECT_DIR: __dirname, PROJECT_DIR: __dirname,
}; };

View File

@ -27,7 +27,6 @@
"winston": "^3.2.1" "winston": "^3.2.1"
}, },
"devDependencies": { "devDependencies": {
"axios": "^0.19.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"eslint": "^5.16.0", "eslint": "^5.16.0",