Task Detail

  • Activity on Thu May 24 2018 01:10:17 GMT+0000 (UTC) IMPORTANT: Create a test case insdie server.js below will cause error because of the async function. Instead of async(req, reply), I will have to change it to function(req, reply) like below: (I don't know why) fastify.get('/staticfile', function(req, reply){ reply.sendFile('test.html'); });

    10/26/2024 14:38:43
  • Activity on Thu May 24 2018 00:50:13 GMT+0000 (UTC) 1. Use fastify-static inside server.js await fastify.register(require('fastify-static'), { root:path.join(__dirname, '..', 'public'), //tell fastify-static where static file location is prefix:'/public/' //url prefix }) 2. Create a test case inside server.js fastify.get('/staticfile', async(req, reply)=>{ reply.sendFile('test.html', {text:'text'}); })

    10/26/2024 14:38:33