annotations

This commit is contained in:
2024-11-27 12:46:03 +02:00
parent 54b8941f3c
commit ad4eef17f5
12 changed files with 514 additions and 36 deletions
+16 -1
View File
@@ -1,14 +1,29 @@
import express from 'express';
/**
* Asset controller plugin
*/
class AssetController{
name = 'assetController'
name = 'assetApi'
route = '/asset'
/**
* Initializes the AssetController plugin
* @param {App} app The application instance
*/
init(app){
const router = express.Router();
const {config} = app;
/**
* API: GET /asset/:type/:id Retrieve asset by type and ID
* @function read
* @param {string} type Type can be "source", "default" or "thumb"
* @param {string} id The name of the asset
* @returns File
* @memberof AssetController
*/
router.get('/:where/:id(*)', async (req, res)=>{
res.sendFile(config.fs.repo + req.params.where + '/' + req.params.id, (err)=>{
if (err){