docs(backend): Setup swagger-autogen

This commit is contained in:
Tibo De Peuter 2025-03-07 20:00:54 +01:00 committed by Tibo De Peuter
parent 3cd7496989
commit ab8ece2a76
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
9 changed files with 929 additions and 19 deletions

28
docs/api/generate.ts Normal file
View file

@ -0,0 +1,28 @@
import swaggerAutogen from "swagger-autogen";
const doc = {
info: {
version: '0.1.0',
title: 'Dwengo-1 Backend API',
description: 'Dwengo-1 Backend API using Express, based on VZW Dwengo',
license: {
name: 'MIT',
url: 'https://github.com/SELab-2/Dwengo-1/blob/336496ab6352ee3f8bf47490c90b5cf81526cef6/LICENSE'
}
},
servers: [
{
url: 'http://localhost:3000/',
},
{
url: 'https://sel2-1.ugent.be/api'
}
]
};
const outputFile = './swagger.json';
const routes = [
'../../backend/src/app.ts'
];
swaggerAutogen({ openapi: '3.1.0' })(outputFile, routes, doc);