The Application: Running the Code
Take a look at how to start the application and test the functionality in the shell.
We'll cover the following
Code
To run the shell, we’ll use the command iex -S mix
. The shell will now start and we can test the functions that we created. To test the database functions in the shell we first have to compile the database module. For this, we will have to run the following two commands:
ExUnit.start()
c "lib/bookstore/db.ex"
After this, we can run the functions.
Let’s start off with a few basic functions:
Bookstore.DB.setup()
Bookstore.DB.add_book("978-0-7546-7834-2", "Behind Human Error", "David D Woods")
Bookstore.DB.find_book_by_author("Woods")
Bookstore.DB.teardown()
Get hands-on with 1400+ tech skills courses.