This is the companion example for the tutorial: Using Lua to Access a PostgreSQL Database.
- Create an ElephantSQL account and compile the required C code as explained in the tutorial: Using Lua to Access a PostgreSQL Database
- Open mako.conf in an editor and set the required attributes in table 'cinfo' with values copied from your ElephantSQL account
- Save mako.conf
- In a command window, navigate to the directory LSP-Examples/PostgreSQL and start the mako server as follows: mako
- The application should connect to your ElephantSQL instance and you should see the folowing being printed: DB connected: yes
- Open a browser and navigate to http://localhost:portno, where portno is the server's listening port
- Enter data in the HTML form and click submit
- www/.preload -- Creates a 'pg' instance
- www/.lua/pg.lua -- Library 'pg' simplifies using library 'pgsql' (pgsql.so) and maintains one DB connection
- www/index.lsp -- Example code