text: import { Router } from 'express';
  import swaggerSpec from './utils/swagger';
  import usersController from './controllers/users';
  import patientController from './controllers/patientController';
  import annotationController from './controllers/annotationController';
  import tagsController from './controllers/tagsController';
  import batchesController from './controllers/batchController';
  import annotationLabelsController from './controllers/annotationLabelsController';
  
  /**
   * Contains all API routes for the application.
   */
  let router = Router();
  
  router.use(function(req, res, next) {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
    next();
  });
  
  /**
   * GET /api/swagger.json
   */
  router.get('/swagger.json', (req, res) => {
    res.json(swaggerSpec);
  });
  
  /**
   * @swagger
   * definitions:
   *   App:
   *     title: App
   *     type: object
   *     properties:
   *       app:
   *         type: string
   *       apiVersion:
   *         type: string
   */
  
  /**
   * @swagger
   * /:
   *   get:
   *     summary: Get API version
   *     description: App version
   *     produces:
   *       - application/json
   *     tags:
   *       - Base
   *     responses:
   *       200:
   *         description: Application and API version
   *         schema:
   *           title: Users
   *           type: object
   *           $ref: '#/definitions/App'
   */
  router.get('/', (req, res) => {
    res.json({
      app: req.app.locals.title,
      apiVersion: req.app.locals.version
    });
  });
  
  router.use('/users', usersController);
  router.use('/patients', patientController);
  router.use('/annotations', annotationController);
  router.use('/tags', tagsController);
  router.use('/batches', batchesController);
  router.use('/annotationlabels', annotationLabelsController);
  
  export default router;
  