60 lines
1.4 KiB
JavaScript
60 lines
1.4 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 } |