LuaSql-Sqlite3 with html using uhttpd server

How can I connect my database using lua and display data to server in a html.
I followed below tutorials and individually both are working .
I can connect to database and can fetch data and display them to serial.

I can also display html template in browser via uhttpd server.

but how can i merge them to fetch data from database and show them to the html.