npm i swagger-jsdoc swagger-ui-express
npm i -D @types/swagger-jsdoc @types/swagger-ui-express
import swaggerUi from 'swagger-ui-express';
import { swaggerSpec } from './config/swagger';
import { logger, morganMiddleware } from './config/winston';
app.use(morganMiddleware);
app.use('/swagger', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
import swaggerJSDoc from 'swagger-jsdoc';
import packageJson from '../../package.json';
const options = {
swaggerDefinition: {
info: {
title: packageJson.name,
version: packageJson.version,
description: packageJson.description || packageJson.name
},
basePath: '/api/'
},
apis: ['./src/routes/v1/index.ts']
};
export const swaggerSpec = swaggerJSDoc(options);
import { Router } from 'express';
import checkIp from './checkIp';
import contact from './contact';
import focus from './focus';
import news from './news';
import notice from './notice';
import quotation from './quotation';
import response from './response';
const router = Router();
/**
* @swagger
* /checkIp:
* get:
* summary: 偵測 IP 來源地區
* responses:
* 200:
* description: OK
* 400:
* description: Client error
* 500:
* description: Server error
*/
router.use('/checkIp', checkIp);
/**
* @swagger
* /contact:
* post:
* summary: 聯繫我們
* parameters:
* - name: body
* in: body
* type: object
* properties:
* name:
* type: string
* surname:
* type: string
* mobile:
* type: string
* email:
* type: string
* area:
* type: string
* type:
* type: string
* iScustomer:
* type: string
* login:
* type: string
* content:
* type: string
* required:
* - name
* - surname
* - mobile
* - email
* - area
* - type
* responses:
* 200:
* description: OK
* 400:
* description: Client error
* 500:
* description: Server error
*/
router.use('/contact', contact);
/**
* @swagger
* /focus:
* get:
* summary: 財經新聞
* parameters:
* - name: lang
* in: query
* required: true
* type: string
* responses:
* 200:
* description: OK
* 400:
* description: Client error
* 500:
* description: Server error
*/
router.use('/focus', focus);
/**
* @swagger
* /news:
* get:
* summary: 取得即時新聞
* responses:
* 200:
* description: OK
* 400:
* description: Client error
* 500:
* description: Server error
*/
router.use('/news', news);
/**
* @swagger
* /notice:
* get:
* summary: 平台公告
* parameters:
* - name: lang
* in: query
* required: true
* type: string
* responses:
* 200:
* description: OK
* 400:
* description: Client error
* 500:
* description: Server error
*/
router.use('/notice', notice);
/**
* @swagger
* /quotation:
* get:
* summary: 市場分析
* parameters:
* - name: lang
* in: query
* required: true
* type: string
* responses:
* 200:
* description: OK
* 400:
* description: Client error
* 500:
* description: Server error
*/
router.use('/quotation', quotation);
/**
* @swagger
* /response:
* get:
* summary: 企業責任
* parameters:
* - name: lang
* in: query
* required: true
* type: string
* responses:
* 200:
* description: OK
* 400:
* description: Client error
* 500:
* description: Server error
*/
router.use('/response', response);
export default router;
| | Amount | Calories | Protein | Fat| Fiber |
Apr 1, 202509:13/09:06離開機場, 搭乘S1或S8到München Hbf/ Ost車站旁邊的 EDEKA 跟 dm 採買10:55 Hbf/ 11:04 Ost 出發Salzburg, 12:42 抵達
Nov 26, 2024Generate AI
Jun 8, 2024You can later watch this video to recap
May 1, 2024or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up