Gobeer is an API developed for studies purposes. If you want to create your own API, follow along with this tutorial series that explains everything about this API.
This API uses a sqlite3
database because of its simplicity. Please, follow the steps below to create your databases.
Firstly, create the main sqlite3
database:
$ sqlite3 data/beer.db
sqlite> CREATE TABLE beer(id INTEGER PRIMARY KEY AUTOINCREMENT, name text NOT NULL, type integer NOT NULL, style integer not null);
sqlite> .quit
Then, create the database that will be used on tests:
$ sqlite3 data/beer_test.db
sqlite> CREATE TABLE beer(id INTEGER PRIMARY KEY AUTOINCREMENT, name text NOT NULL, type integer NOT NULL, style integer not null);
sqlite> .quit
This repository offers a set of make
commands to help the developing process.
make test
: runs all unit tests developed in the repository. It will show the tests coverage in the terminal.make coverage
: Same asmake test
, but a pop-up will appear where you can check which files and lines the test cases are covering.make run
: runs the application.make create
: makes aPOST
request to the API to create one Beer. It expects those mandatory parameters:name
,type
andstyle
.
Example:
make create name=Heineken type=2 style=6
make list
: makes aGET
request to the API to list all Beers.make get
: makes aGET
request to the API to get a specific Beer. It expects theid
parameter.
Example:
make get id=1
make update
: makes aPUT
request to the API to update a Beer. It expects those mandatory parameters:id
,name
,type
andstyle
.
Example:
make update id=1 name=Beck's type=2 style=12
make delete
: makes aDELETE
request to the API to delete a Beer. It expects theid
parameter.
Example:
make delete id=1
make container
: builds and runs the docker container.