Added test cases for @hapi/hapi

This commit is contained in:
Napalys
2025-03-26 11:35:58 +01:00
parent 9d3d3deffa
commit 649b4e07e2
2 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
const Hapi = require('@hapi/hapi');
const fs = require('fs').promises;
(async () => {
const server = Hapi.server({
port: 3005,
host: 'localhost'
});
server.route({
method: 'GET',
path: '/hello',
handler: async (request, h) => {
const filepath = request.query.filepath; // $ MISSING: Source
const data = await fs.readFile(filepath, 'utf8'); // $ MISSING: Alert
const firstLine = data.split('\n')[0];
return firstLine;
}
});
await server.start();
})();