60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
import express from 'express';
|
|
|
|
/**
|
|
* GamesController. API for the games manager, граничен клас за комуникация с модула за игрови дефиниции
|
|
*/
|
|
class GamesController{
|
|
|
|
name = 'gamesApi'
|
|
route = '/api/game'
|
|
|
|
/**
|
|
* Initializes the GamesController plugin, инициализация
|
|
* @param {App} app The application instance, апликация
|
|
*/
|
|
init(app){
|
|
const router = express.Router();
|
|
const { games } = app;
|
|
|
|
/**
|
|
* API: PUT /api/game/ Create or update game, създаване/обновяване на игрова дефиниция
|
|
* @function createOrUpdate
|
|
* @memberof GamesController
|
|
*/
|
|
router.put('/', async (req, res)=>{
|
|
|
|
});
|
|
|
|
/**
|
|
* API: POST /api/game/ List games by given criteria, търсене в игрови дефиниции
|
|
* @function list
|
|
* @returns {Game[]}
|
|
* @memberof GamesController
|
|
*/
|
|
router.post('/', async (req, res)=>{
|
|
})
|
|
|
|
/**
|
|
* API: GET /api/game/:id Retrieve game by ID, извличане на игрова дефиниция
|
|
* @function read
|
|
* @param {string} id The id of the game, идентификатор на дефиницията
|
|
* @returns {Game}
|
|
* @memberof GamesController
|
|
*/
|
|
router.get('/:id', async (req, res)=>{
|
|
})
|
|
|
|
/**
|
|
* API: DELETE /api/game/:id Delete game by ID, изтриване на игрова дефиниция
|
|
* @function remove
|
|
* @param {string} id The id of the game, идентификатор на дефиницията
|
|
* @memberof GamesController
|
|
*/
|
|
router.delete('/:id', async (req, res)=>{
|
|
})
|
|
|
|
app.webServer.xapp.use(this.route, router);
|
|
}
|
|
}
|
|
|
|
export { GamesController } |