Ken & Nicki Single Resource Project
We created this app - Cereal Killahs to showcase 9 convicted cereal types - Originally, there were 10 but one of the convicted cereals escaped!
To test the functionalities for themselves, devs can do the following steps:
-
fork & clone this repository
-
cd into
-
npm i
ornpm install
in the command line to update required dependencies -
npm run db:init
in the command line to initialize the SQL database Users should see text similar to below letting you know the database was created:
npm run db:seed
in the command line to seed data ino the table Users should see text simmilar to below to let you know the table has been created:
- To start the server
npm start
npm run start
|| to see the data in PostgreSQLpsql
=>\c cereals
Note: If no data exists in tables (\dt
shows "Did not find any relations.", open thedb
directory, copy lines 6-15 fromschema.sql
in psql => enter, then copy lines 5-14 fromseed.sql
To see the data as json in the browser, users can go here => ![https://serial-killa-foreal.onrender.com/cereals]
To see the database in psql, paste this SELECT * FROM cereals
This will retrieve all cereals:
TRY THESE AS FUNCTIONALITY TESTS:
Filter by brand:
SELECT * FROM cereals WHERE brand = 'General Mills';
Find cereals with a specific type:
SELECT * FROM cereals WHERE type = 'Chocolate';
Sort cereals by rating:
SELECT * FROM cereals ORDER BY rating DESC;
Retrieve user's favorite cereals:
SELECT * FROM cereals WHERE is_favorite = true;
Search cereals by name:
SELECT * FROM cereals WHERE name LIKE '%Cinnamon%';
INSERT INTO cereals (name, brand, type, price, is_favorite, rating, image_url) VALUES ('Blueberry Crunch', 'Berry Bliss', 'Fruit', 4.79, true, 3, 'https://example.com/blueberry-crunch-image.png');
DELETE FROM cereals WHERE name = 'Froot Loops';