-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.js
More file actions
74 lines (70 loc) · 2.18 KB
/
Copy pathswagger.js
File metadata and controls
74 lines (70 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const swaggerAutogen = require('swagger-autogen')({ openapi: '3.0.0' });
require('dotenv').config();
const doc = {
info: {
title: 'BetterStudent API',
description: 'Description',
},
host: `${process.env.EXPO_PUBLIC_EXPRESS_URL}`,
servers: [
{ url: `${process.env.EXPO_PUBLIC_EXPRESS_URL}` },
],
schemes: ['http'],
components: {
schemas: {
Student: {
$name: 'Elian',
$email: 'elian1234@gmail.com',
$info: 'Coloque aqui su informacion académica',
$phone_number: '1234567890',
$password: '1234567890',
rating: 0,
$career_id: '1',
},
Login: {
$email: 'example@email.com',
$password: '1234567890'
},
Career: {
$name: 'Ingeniería en Sistemas Computacionales',
$faculty: 'Facultad de Ingeniería'
},
Review: {
$student_id: '1',
$title: 'Excelente profesor',
$comment: 'El profesor es muy bueno',
$rating: '5',
$date: '2021-10-10'
},
Section: {
$subject_id: '1',
$schedule_id: '1',
$classroom_code: '123',
$professor_id: '1',
$number: '1'
},
Friend: {
$student_id: '1',
$friend_id: '2'
},
Subject: {
$name: 'Programación Orientada a Objetos'
},
Schedule: {
$start_time: '10:00',
$end_time: '11:00',
$day: 'Lunes'
},
Professor: {
$name: 'Juan',
$email: 'juan@email.com'
}
}
},
};
const outputFile = './swagger-output.json';
const endpointsFiles = ['./server.js'];
/* NOTE: if you use the express Router, you must pass in the
'endpointsFiles' only the root file where the route starts,
such as index.js, app.js, routes.js, ... */
swaggerAutogen(outputFile, endpointsFiles, doc);