-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Formating and details on swagger page
- Loading branch information
Showing
6 changed files
with
104 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
const sqlite3 = require('sqlite3').verbose(); | ||
const logger = require('./../utils/logger'); | ||
const path = require('path'); | ||
const dbPath = path.join(__dirname, '../data/database.db'); | ||
|
||
const db = new sqlite3.Database(dbPath, (err) => { | ||
if (err) { | ||
logger.error('Error opening database:', err.message); | ||
} else { | ||
db.run(`CREATE TABLE IF NOT EXISTS data ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
info TEXT NOT NULL, | ||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP | ||
)`); | ||
logger.info('Database created / opened succesfully'); | ||
} | ||
}); | ||
|
||
module.exports = db; | ||
const sqlite3 = require("sqlite3").verbose(); | ||
const logger = require("./../utils/logger"); | ||
const path = require("path"); | ||
const dbPath = path.join(__dirname, "../data/database.db"); | ||
|
||
const db = new sqlite3.Database(dbPath, (err) => { | ||
if (err) { | ||
logger.error("Error opening database:", err.message); | ||
} else { | ||
db.run(`CREATE TABLE IF NOT EXISTS data ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
info TEXT NOT NULL, | ||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP | ||
)`); | ||
logger.info("Database created / opened succesfully"); | ||
} | ||
}); | ||
|
||
module.exports = db; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
const { format } = require('winston'); | ||
|
||
module.exports = { | ||
level: 'info', | ||
format: format.combine( | ||
format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), | ||
format.printf(({ timestamp, level, message }) => `${timestamp} [${level.toUpperCase()}]: ${message}`) | ||
), | ||
transports: { | ||
console: true, | ||
file: { | ||
enabled: true, | ||
filename: 'logs/app.log', | ||
}, | ||
}, | ||
}; | ||
const { format } = require("winston"); | ||
|
||
module.exports = { | ||
level: "info", | ||
format: format.combine( | ||
format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), | ||
format.printf( | ||
({ timestamp, level, message }) => | ||
`${timestamp} [${level.toUpperCase()}]: ${message}`, | ||
), | ||
), | ||
transports: { | ||
console: true, | ||
file: { | ||
enabled: true, | ||
filename: "logs/app.log", | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
const options = { | ||
definition: { | ||
openapi: '3.0.0', | ||
info: { | ||
title: 'Your API Documentation', | ||
version: '1.0.0', | ||
description: 'API documentation with authentication', | ||
}, | ||
components: { | ||
securitySchemes: { | ||
passwordAuth: { | ||
type: 'apiKey', | ||
in: 'header', | ||
name: 'x-password', | ||
description: 'Password required for authentication', | ||
}, | ||
}, | ||
}, | ||
security: [ | ||
{ | ||
passwordAuth: [], | ||
}, | ||
], | ||
}, | ||
apis: ['./routes/*/*.js'], // Point to your route files | ||
}; | ||
|
||
module.exports = options; | ||
const options = { | ||
definition: { | ||
failOnErrors: true, | ||
openapi: "3.0.0", | ||
info: { | ||
title: "DockStatAPI", | ||
version: "2", | ||
description: "An API used to query muliple docker hosts", | ||
}, | ||
components: { | ||
securitySchemes: { | ||
passwordAuth: { | ||
type: "apiKey", | ||
in: "header", | ||
name: "x-password", | ||
description: "Password required for authentication", | ||
}, | ||
}, | ||
}, | ||
security: [ | ||
{ | ||
passwordAuth: [], | ||
}, | ||
], | ||
}, | ||
apis: ["./routes/*/*.js"], | ||
}; | ||
|
||
module.exports = options; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters