Start init
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
const express = require("express");
|
||||
const app = express();
|
||||
const swaggerUi = require('swagger-ui-express');
|
||||
const swaggerDocument = require('./swagger.json');
|
||||
const port = 3000;
|
||||
|
||||
app.use('/swagger-ui', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||
|
||||
app.get("/", (request, respond) => {
|
||||
respond.send("Test")
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log("Server is running on port " + port);
|
||||
})
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "gambling_api",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "swagger.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ScriptSorcerer20/Gambling_API.git"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"express": "^5.1.0",
|
||||
"swagger-ui-express": "^5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"swagger-autogen": "^2.23.7"
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
const swaggerAutogen = require('swagger-autogen')({openapi: '3.0.0'});
|
||||
|
||||
const doc = {
|
||||
info: {
|
||||
title: 'GAMBLE!',
|
||||
description: 'Gambling API'
|
||||
},
|
||||
host: 'localhost:3000'
|
||||
};
|
||||
|
||||
const outputFile = './swagger.json';
|
||||
const routes = ['./gambling.js'];
|
||||
|
||||
/* NOTE: If you are using the express Router, you must pass in the 'routes' only the
|
||||
root file where the route starts, such as index.js, app.js, routes.js, etc ... */
|
||||
|
||||
swaggerAutogen(outputFile, routes, doc);
|
||||
Reference in New Issue
Block a user