None of these steps are mandatory, but try to complete as many as possible.
- Clone this repo
- Push your work
- Send us an email with the link to your public repository
-
add a
/zaptic
route that will return the Zaptic logo like below -
create error handling middleware that returns the message below when you navigate to an inexistent route
Seems like you're lost😱. Do you need some help?🕵️
-
add functionality to read in data from
users.csv
(src/data/users.csv
) and convert it to json -
create user api endpoints in the
src/api
folder under the routeapi/v1/users
to interact with data read from the csv file in the previous step.GET
-api/v1/users/<id>
- get user by idPOST
api/v1/users
- create a new user
-
secure the
POST
endpoint with a password
Given the following SQL statements:
drop table if exists users;
CREATE TABLE users (
id int UNIQUE,
first_name varchar(255),
last_name varchar(255),
email varchar(255),
job_title varchar(255),
star boolean
);
INSERT into users(id, first_name, last_name, email, job_title, star) values
(1,'Terry','Medhurst','terry.medhurst@gmail.com','Corporate Operations Engineer',false),
(2,'John','Allcot','john.allcot@gmail.com','Dynamic Intranet Analyst',false),
(3,'Alan','Wattson','alan.wattson@gmail.com','National Identity Orchestrator',true),
(4,'Anna','Bishop','anna.bishop@gmail.com','Regional Integration Executive',false),
(5,'Samuel','Sharp','samuel.sharp@gmail.com','Future Resonance Architect',false);
drop table if exists products;
CREATE TABLE products (
id int UNIQUE,
title varchar(255),
description varchar(255),
price int
);
INSERT into products(id,title,description,price) values
(1, 'iPhone 14', 'the newest iPhone', 000),
(2, 'Chocolate Muffin', 'the best desert there is', 000),
(3, 'Philosophers stone', 'Mythic alchemical substance capable of turning base metals such as mercury into gold', 9999);
drop table if exists purchases;
CREATE TABLE purchases (
id int,
product int references products(id),
buyer int references users(id),
count int
);
INSERT into purchases(id,product,buyer,count) values
(1, 1, 1, 1),
(2, 1, 2, 1),
(3, 1, 3, 2),
(4, 1, 5, 1),
(5, 2, 1, 2),
(6, 3, 1, 1),
(7, 2, 2, 5),
(8, 2, 4, 3),
(9, 2, 3, 2),
(10, 2, 3, 4);
You can use https://www.db-fiddle.com/ to test your SQL code.
Provide screenshots of the db-fiddle page (make sure query and results are visible) as proof for each of the following tasks. Please save them in a folder called proof
along with a separate .sql
file for the query you wrote in each task.
- write an SQL statement to get all attributes except
id
of products that have the word “stone” in their title - list all user
emails
who purchased at least oneiPhone 14
- list all purchases of
star
users (users which havestar = true
) in the following format:
purchase id, product name, count, buyer email