feat: Add Swagger API documentation
This commit introduces Swagger API documentation for all endpoints in the application. - Installs and . - Configures Swagger in to generate and serve API documentation at . - Adds JSDoc-style Swagger annotations to all routes in and the directory (, , , , , ). - Defines a cookie-based security scheme for authenticated routes. This allows for interactive API documentation and testing via the endpoint.
This commit is contained in:
@@ -67,12 +67,51 @@ const getMedia = async (eventId) => {
|
||||
};
|
||||
|
||||
//getMedia('y42zyf3').then(console.log)
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Subsplash
|
||||
* description: Subsplash API integration
|
||||
*/
|
||||
|
||||
DB.getDB.then((DB) => {
|
||||
/**
|
||||
* @swagger
|
||||
* /subsplash/events/{calendarId}:
|
||||
* get:
|
||||
* summary: Get events from a Subsplash calendar
|
||||
* tags: [Subsplash]
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: calendarId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
*/
|
||||
router.get("/events/:calendarId", async (req, res) => {
|
||||
const events = await getEvents(req.params.calendarId)
|
||||
return res.json(events);
|
||||
});
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /subsplash/media/{seriesId}:
|
||||
* get:
|
||||
* summary: Get media from a Subsplash media series
|
||||
* tags: [Subsplash]
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: seriesId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
*/
|
||||
router.get("/media/:seriesId", async (req, res) => {
|
||||
const events = await getMedia(req.params.seriesId)
|
||||
return res.json(events);
|
||||
|
||||
Reference in New Issue
Block a user