<-- Previous | Contents Page |
Once you've created, built and tested your web server, you can start using it to set up data in your database.
Start the web server like so:
$ animals
or you can run it in verbose mode and see tracing messages in your command window:
$ animals -v
The first time you run the server it will create the database tables.
The server runs on port 4000. In your web browser, navigate to http://localhost:4000
That display the home page of the application.
The home page has two links "Manage cats" and "Manage mice". The first takes you to the index page for the cat resource.
The cats table is currently empty. Use the Create button to create a cat record.
Fill in the values and press the Create Cat button.
If you don't supply all of the mandatory fields, the create page appears again with error messages:
Fix that problem
and try again. The server creates a cat record and then displays the cat index page. The index page lists the cats using the display label defined in the JSON (the id, name and breed). There are links and buttons to edit and delete the records, and a link back to the home page.
To add some mice, use the link to the home page and then the "Manage mice" link.
To stop the server, type ctrl/c in the command window. (Hold down the ctrl key and type a single "c", you don't need to press the enter key.)
Contents Page | Previous |