annotations
This commit is contained in:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user