rename index.js to main.js

remove unused imports in main.js,
add function prototypes to db.js
This commit is contained in:
Arthur Lu 2023-02-26 08:36:27 +00:00
parent 62eca6c427
commit c9595980cd
3 changed files with 22 additions and 3 deletions

20
db.js Normal file
View File

@ -0,0 +1,20 @@
/**
* called at app startup, can be used to initialize any variables needed for database access
*/
function init () {}
/**
* user requests additional resources specified in k-v pairs
* @param {string} user user's proxmox username in the form username@authrealm
* @param {Object} resources k-v pairs with resource name as keys and resource ammount as values
*/
function requestResources (user, resources) {}
/**
* user releases allocated resources specified in k-v pairs
* @param {string} user user's proxmox username in the form username@authrealm
* @param {Object} resources k-v pairs with resource name as keys and resource ammount as values
*/
function releaseResources (user, resources) {}
module.exports = {init, requestResources, releaseResources};

View File

@ -8,8 +8,7 @@ const axios = require('axios');
var api = require("./package.json"); var api = require("./package.json");
const {pveAPI, pveAPIToken, listenPort} = require("./vars.js"); const {pveAPI, pveAPIToken, listenPort} = require("./vars.js");
const { token } = require("morgan"); const {init, requestResources, releaseResources} = require("./db.js");
const { response } = require("express");
const app = express(); const app = express();
app.use(helmet()); app.use(helmet());

View File

@ -2,7 +2,7 @@
"name": "proxmoxaas-api", "name": "proxmoxaas-api",
"version": "0.0.1", "version": "0.0.1",
"description": "REST API for ProxmoxAAS", "description": "REST API for ProxmoxAAS",
"main": "index.js", "main": "main.js",
"dependencies": { "dependencies": {
"axios": "^1.3.2", "axios": "^1.3.2",
"body-parser": "^1.20.1", "body-parser": "^1.20.1",