Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mvp #145

Open
wants to merge 51 commits into
base: main
Choose a base branch
from
Open

mvp #145

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
05b5922
Update README.md
wlongmireBloomTech Feb 1, 2021
0ec9936
Update README.md
wlongmireBloomTech Feb 1, 2021
5559df0
Merge pull request #89 from LambdaSchool/updated_codegrade_flow-1
wlongmireBloomTech Feb 1, 2021
e5a7727
Update README.md
wlongmireBloomTech Feb 1, 2021
bfbbe1b
Update README.md
wlongmireBloomTech Feb 1, 2021
04e2f98
Update README.md
wlongmireBloomTech Feb 1, 2021
64e35ce
Create README.md
wlongmireBloomTech Feb 1, 2021
6f60c37
Update README.md
wlongmireBloomTech Feb 1, 2021
769d7fe
Merge branch 'main' of https://github.com/LambdaSchool/web-sprint-cha…
wlongmireBloomTech Feb 1, 2021
068a1a2
adds inteview answers.
wlongmireBloomTech Feb 1, 2021
2c66c6e
adds template and interview-answers.
wlongmireBloomTech Feb 1, 2021
f1b3d79
edit to READMEs.
wlongmireBloomTech Feb 1, 2021
6a24feb
linter
Ladrillo Feb 2, 2021
bb92e35
linter
Ladrillo Feb 2, 2021
1e63ada
formatting
Ladrillo Feb 2, 2021
c8f54ea
Update README_Template.md
wlongmireBloomTech Feb 3, 2021
9e633ee
Update README_Template.md
wlongmireBloomTech Feb 3, 2021
4a3a779
added to readme, readme_template and interview_answers
wlongmireBloomTech Feb 4, 2021
4800127
adds to interview-answers
wlongmireBloomTech Feb 4, 2021
c6ecef1
merges conflicts.
wlongmireBloomTech Feb 4, 2021
c7c5fb6
adds to instructions and instruction template.
wlongmireBloomTech Feb 4, 2021
db0fa30
adds to instructions and instruction template.
wlongmireBloomTech Feb 4, 2021
ef38582
adds to readme.
wlongmireBloomTech Feb 11, 2021
af1ade3
adds to readme.
wlongmireBloomTech Feb 11, 2021
905a448
adds in readme.
wlongmireBloomTech Feb 26, 2021
5d2bfaf
adds in handler code.
wlongmireBloomTech Feb 26, 2021
d2fdca4
removes test code.
wlongmireBloomTech Feb 26, 2021
7839b47
adds to backend.
wlongmireBloomTech Feb 26, 2021
3dacfa9
changes to tests and code to relect tests.
wlongmireBloomTech Mar 2, 2021
e0ba05c
adds to update code.
wlongmireBloomTech Mar 2, 2021
b22ea43
refines readme.
wlongmireBloomTech Mar 4, 2021
c47e18e
Merge pull request #101 from LambdaSchool/update
wlongmireBloomTech Mar 26, 2021
846b807
Update handlers.js
wlongmireBloomTech May 21, 2021
554e784
updates login.js.
wlongmireBloomTech May 21, 2021
78b61e3
adds new tests and other code.
wlongmireBloomTech Jun 2, 2021
1d68f36
updates to Readme.
wlongmireBloomTech Jun 2, 2021
d06f34f
adds to handlers.
wlongmireBloomTech Jun 2, 2021
74b3005
Update README.md
wlongmireBloomTech Jun 18, 2021
4eacd0f
adds logout."
wlongmireBloomTech Jun 18, 2021
a227340
Merge branch 'main' of https://github.com/LambdaSchool/web-sprint-cha…
wlongmireBloomTech Jun 18, 2021
ed9e0d3
adds logout endpoint and updated readme.
wlongmireBloomTech Jun 21, 2021
1d728f4
updates.
wlongmireBloomTech Jul 3, 2021
be29be4
adds react.
wlongmireBloomTech Jul 3, 2021
0103ac6
adds tests.
wlongmireBloomTech Jul 4, 2021
65676c6
adds error message updates.
wlongmireBloomTech Jul 22, 2021
c215825
adds routing language.
wlongmireBloomTech Jul 23, 2021
072270b
adds package and readme bits.
wlongmireBloomTech Aug 5, 2021
955044c
Update README.md
wlongmireBloomTech Sep 3, 2021
8cb516b
Update README.md
cladams0203 Sep 10, 2021
fd43b3d
Update README.md
cladams0203 Sep 10, 2021
e4d42d9
mvp
Sep 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions CodeGrade-webhook.md

This file was deleted.

121 changes: 61 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,90 @@

**Read these instructions carefully. Understand exactly what is expected _before_ starting this Sprint Challenge.**

This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **advanced web applications**. During this sprint, you studied **React testing, client-side auth, HTTP methods, and Vercel**.
This challenge allows you to practice the concepts and techniques learned over the past sprint and apply them in a concrete project. This sprint explored **advanced web applications**. During this sprint, you studied **React testing, client-side auth, HTTP methods, and Vercel**.

In your challenge this week, you will demonstrate your mastery of these skills by creating **a login page** and **basic CRUD application.**

This is an individual assessment. All work must be your own. Your challenge score is a measure of your ability to work independently using the material covered through this sprint. You need to demonstrate proficiency in the concepts and objectives introduced and practiced in preceding days.

You are not allowed to collaborate during the sprint challenge. However, you are encouraged to follow the twenty-minute rule and seek support from your TL if you need direction.

_You have **three hours** to complete this challenge. Plan your time accordingly._
This is an individual assessment. All work must be your own. All projects will be submitted to codegrade for automated review. You will also be given feedback by code reviewers the Monday after challenge submissions. For more information on the review process [click here.](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-c5147cee220c4044a25de28bcb6bb54a)

You are not allowed to collaborate during the sprint challenge. However, you are encouraged to follow the twenty-minute rule and seek support by dropping a :wave: in your help channel when needed.

## Introduction

In this project you will create a login page and request a token from the server that you'll use to send all other requests to the server. You will then be able to fetch the color data array, update data, and delete data, and watch the fun happen!

**Note** You can use the sites like the following to get color hex codes:

* [Color-Hex](https://www.color-hex.com/)

### Commits

Commit your code regularly and meaningfully. This helps both you (in case you ever need to return to old code for any number of reasons) and your team lead as the evaluate your solution.

## Instructions

### Task 1: Project Set Up

- [ ] Create a forked copy of this project
- [ ] Clone your OWN version of the repository (Not Lambda's by mistake!)
- [ ] Create a new branch: git checkout -b `<firstName-lastName>`.
- [ ] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly
- [ ] Push commits: git push origin `<firstName-lastName>`
- [ ] **LOOK** at the files in your root directory and notice it' is just a plain ol' React App that we've built using create-react-app.
- [ ] **RUN** npm install install your dependences
- [ ] **RUN** npm start to fire up your React application.

**Setting up the CodeGrade webhook**
Go [here](./CodeGrade-webhook.md) to setup the CodeGrade webhook before you begin.


### Task 1: Transfer Repo
* Clone this repository.
* Implement the project on the automatically generated <firstName-lastName> branch, committing changes regularly.
* Push commits: git push origin <firstName-lastName>.
* RUN npm install to install your dependencies.
* RUN npm start to start your application.

### Task 2: Project Requirements
Your finished project must include all of the following requirements.
Your finished project must include all of the following requirements. **Unlike other projects, the local server used here can not be accessed through the browser. It is started automatically and without the need for starting a server.js file. Feel free to ignore any messages related to MSW or mock service workers. For this and the rest of your sprint challenges, test the functioning of the server directly through your http calls.**

#### Stage 1 - Authentication
Build a login form to authenticate your users.
**See reference materials at the bottom of the this document for details on use the API.**

- [ ] Construct an AXIOS request to retrieve a token from the server. You'll use this token to interact with the API
- [ ] Save the token to localStorage
- [ ] Build a `axiosWithAuth` module to create an instance of axios with the authentication header
- [ ] Build a `PrivateRoute` component and use it to protect a route that renders the `BubblesPage` component
#### Authentication
> *Build a login form to authenticate your users along with all the components and utilities needed to support authentication.*

#### Stage 2 - Consuming the API
* [ ] In `Login.js`, build all UI and state functionality needed to capture a username and password.
* [ ] Add in two routes that display the login component, one for the default path '/' and one for the login path '/login'.
* [ ] **Make sure that the input for your username and password includes the id="username" and id="password" attributes and an id="submit" on the login button. Codegrade autotests will fail without them.**
* [ ] Build in functionality that would allow an error to be displayed in the provided p tag if either the username or password is incorrect.
* [ ] **Make sure your error p tag has an id="error" attribute attached. Codegrade autotests will fail without them.**
* [ ] Construct an http request that retrieves an auth token from the server when the username `Lambda` and the password `School` is passed into the request.
* [ ] Save the token to localStorage.
* [ ] Build a `axiosWithAuth` module within the helpers folder to create an instance of axios with the authentication header.
* [ ] Build a `PrivateRoute` component within the components folder and use it to protect the route that renders the `BubblesPage` component.
* [ ] In `App.js`, build the backend to the logout button. When pressed, send an http request to the logout endpoint and remove the authentication token from localStorage. Use window.location.href to redirect to the login page.

- [ ] When `BubblePages` renders, make a GET request to fetch the color data for your bubbles.
- [ ] In `ColorList.js`, complete the `saveEdit` and `deleteColor` functions to make AJAX requests to the API to edit/delete data
- [ ] Watch and enjoy as your app responds to updates in the data. Check out `Bubbles.js` to see how this is built.
#### Consuming the API
> *Add in the http requests and state changes needed to connect our api to the web application. Consider the effect of authentication on your api requests.*

#### API Documentation
* [ ] In `services/fetchColorServices.js`, build out fetchColorService function to make a GET request to fetch the color data for your bubbles.
* [ ] When `BubblePages` mounts, call fetchColorServices and save it's result in state.
* [ ] In `BubblePage.js`, complete `saveEdit`, and `deleteColor` functions to make API requests for to editing and delete data.
* [ ] Watch and enjoy as your app responds to updates in the data. Check out `Bubbles.js` to see how this is built.

* **[POST]** * to `http://localhost:5000/api/login`: returns a token to be added to the header of all other requests. Pass in the following credentials as the `body` of the request: `{ username: 'Lambda School', password: 'i<3Lambd4' }`
* **[GET]** to `http://localhost:5000/api/colors`: returns the list of colors and their hex codes.
* **[POST]** to `http://localhost:5000/api/colors`: creates a new color object. Pass the color as the `body` of the request (the second argument passed to `axios.post`).
* **[PUT]** to `http://localhost:5000/api/colors/:id`: updates the color using the `id` passed as part of the URL. Send the color object with the updated information as the `body` of the request (the second argument passed to `axios.put`).
* **[DELETE]** to `http://localhost:5000/api/colors/123`: removes the color using the `id` passed as part of the URL (123 in example).
#### Testing
* [ ] Finish the test in `Color.test.js`, `ColorList.test.js`, `BubblePage.test.js`. You will need to use rerendering, function mocking and spies in order to complete.

#### Stage 3 Testing
- [ ] Finish the test in `BubblePage.test.js` to test that your app is fetching the bubble data from the API
**Notes:**
* You are welcome to create additional files but **do not move or rename existing files** or folders.
* Do not change your `package.json` file except to install additional libraries.
* In your solution, it is essential that you follow best practices and produce clean and professional results.
* Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work.
* It is better to submit a challenge that meets MVP than one that attempts too much and does not.

In your solution, it is essential that you follow best practices and produce clean and professional results. You will be scored on your adherence to proper code style and good organization. Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. It is better to submit a challenge that meets MVP than one that attempts too much and does not.
### Reference Materials

### Task 3: Stretch Goals
#### API Documentation
* **[POST]** * to `http://localhost:5000/api/login`: returns a token to be added to the header of all other requests. Pass in the following credentials as the `body` of the request: `{ username: 'Lambda', password: 'School' }`
* **[POST]** * to `http://localhost:5000/api/logout`: returns a token to be added to the header of all other requests.
* **[GET]** to `http://localhost:5000/api/colors`: returns the list of colors and their hex codes. This endpoint canYeah only be accessed by an autheticated user.
* **[POST]** to `http://localhost:5000/api/colors`: creates a new color object. Pass the color as the `body` of the request (the second argument passed to `axios.post`). This endpoint can only be accessed by an autheticated user.
* **[PUT]** to `http://localhost:5000/api/colors/:id`: updates the color using the `id` passed as part of the URL. Send the color object with the updated information as the `body` of the request (the second argument passed to `axios.put`). This endpoint can only be accessed by an authenticated user.
* **[DELETE]** to `http://localhost:5000/api/colors/123`: removes the color using the `id` passed as part of the URL (123 in example). This endpoint can only be accessed by an autheticated user.

#### Hex Color Examples
**Note** You can use the sites like the following to get color hex codes:
* [Color-Hex](https://www.color-hex.com/)

After finishing your required elements, you can push your work further. These goals may or may not be things you have learned in this module but they build on the material you just studied. Time allowing, stretch your limits and see if you can deliver on the following optional goals:
## Submission format

* [ ] Build out another form to add a new color to your color list
* [ ] Build a custom hook called `useApi` that you can use to make all of your API calls
* [ ] Add more tests to give you further confidence in the code you're shipping
* [ ] Submit via Codegrade by committing and pushing any new changes.
* [ ] Check codegrade for automated feedback.
* [ ] Check codegrade on Monday following the Sprint Challenge for reviewer feedback.
* [ ] Any changes pushed to your "main" branch will resubmitted to codegrade if pushed before the sprint challenge deadline. Changes after the deadline will not be reviewed.

## Submission format
## Interview Questions

Follow these steps for completing your project.
Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. Add your answers to the questions within `interview_answers.md` file. These will not be counted as a part of your sprint score but will be helpful for preparing you for your endorsement interview, and enhancing overall understanding.

- [ ] Ensure that your projects are complete on your <firstName-lastName> branch.
- [ ] Merge your <firstName-lastName> branch into your main branch.
- [ ] Push your main branch to github and check that it is registers within codegrade.
- [ ] Check your personal feedback the following Monday. For more information check [here](https://www.notion.so/lambdaschool/How-to-View-Feedback-in-CodeGrade-Student-facing-c5147cee220c4044a25de28bcb6bb54a)
1. Explain what a token is used for.
2. What steps can you take in your web apps to keep your data secure?
3. Describe how web servers work.
4. Which HTTP methods can be mapped to the CRUD acronym that we use when interfacing with APIs/Servers.
15 changes: 15 additions & 0 deletions interview_answers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Interview Answers
Be prepared to demonstrate your understanding of this week's concepts by answering questions on the following topics. These will not be counted as a part of your sprint score but will be helpful for preparing you for your endorsement interview, and enhancing overall understanding.


1. Explain what a token is used for.
Tokens are strings that are used for user authentication. they are normally assigned when we make login post/requests with apis
2. What steps can you take in your web apps to keep your data secure?
use routes and authentication tokens are good for keeping data secure this also helps to make sure that the right authentication is happening and users are accessing areas of the application that they should be accessing
3. Describe how web servers work.
they hold code inside for each website
4. Which HTTP methods can be mapped to the CRUD acronym that we use when interfacing with APIs/Servers.
delete - DELETE
read - GET
create - POST
update - PUT
Loading