anickacodes / Cereal-Killahs-BackEnd

Ken & Nicki Single Resource Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cereal-Killahs-BackEnd

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:

  1. fork & clone this repository

  2. cd into

  3. npm i or npm install in the command line to update required dependencies

  4. 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:

Screenshot 2023-11-12 at 9 04 09 PM
  1. 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:
Screenshot 2023-11-12 at 9 06 26 PM
  1. To start the server npm start npm run start || to see the data in PostgreSQL psql => \c cereals Note: If no data exists in tables (\dt shows "Did not find any relations.", open the db directory, copy lines 6-15 from schema.sql in psql => enter, then copy lines 5-14 from seed.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';

About

Ken & Nicki Single Resource Project


Languages

Language:JavaScript 100.0%