% this is how to use it
% output: https://user-images.githubusercontent.com/26366184/80920928-4107b100-8d73-11ea-9a63-6216be0e930d.png


\begin{figure}[hbt!]
\begin{lstlisting}[style=ES6]
import express from 'express'
import { promises as fs } from 'fs'
import path from 'path'
import { asyncMiddleware } from '../functions'
import { imagesPath } from '../../config'

const router = express.Router()

/**
 * Get the list of all files in the images directory
 *
 * @returns {String[]} The list of files
 * @throws The directory does not exist or is not accessible
 */
export const getSceneList = () => fs.readdir(imagesPath).catch(() => {
  throw new Error(`Can't access the "${path.basename(imagesPath)}" directory. Check it exists and you have read permission on it.`)
})

// Actual API route definition
router.get('/listScenes', asyncMiddleware(async (req, res) =>
  res.json({ data: await getSceneList() })))

export default router
\end{lstlisting}
\caption{Code d'une route d'API \emph{/api/listScenes} (Fichier : \emph{/server/routes/listScenes.js})}
\label{fig:code-route-api}
\end{figure}
