February 2018
Intermediate to advanced
406 pages
9h 55m
English
To connect the product API to an external database instead of an in-memory database, first create a container image with the data already populated in it:
create table product(id serial primary key, name varchar(20), cat_id int not null);
begin;
insert into product(name, cat_id) values ('Apples', 1);
insert into product(name, cat_id) values ('Oranges', 1);
insert into product(name, cat_id) values ('Bananas', 1);
insert into product(name, cat_id) values ('Carrots', 2);
insert into product(name, cat_id) values ('Beans', 2);
insert into product(name, cat_id) values ('Peas', 2);
commit;
Read now
Unlock full access