Updates : ATM i'm working on unit tests. I'm a little out of practice so this is a great way of doing a refresher :)
This was initially a Bootcamp project that I started with some friends but still needed to finish. I've refactored some initial code, added a delete review feature, improved website navigability and styled it using Bulma. It's still buggy, and I am working on adding images to the database and conditionally rendering some buttons.
I couldn't deploy it yet but If you want to check it out you can ask me for the JWT secret code in linkedIn at https://www.linkedin.com/in/yanina-amatore/ and I'll share it with you.
Run the following commands in your terminal:
npm install
npm run knex migrate:latest
npm run knex seed:run
To run in development:
npm run dev
To run in production:
npm start
The focus of this app is to practice using the Full Stack we teach, (with auth in place) in a large scale app.
The idea of the app is to create a blog style site for Pickle to post about places they have eaten at and review them, and for people who follow Pickle to be able to save places for them to eat at later.
As she grows in popularity, Pickle hopes to make the world (or at least Wellington) a more dog-friendly place! Not just dog-tolerant.
A Boilerplate is already set up for you with everything you will need to get started. This boilerplate is set up to use:
The migration and seeds for the users table, and all login functionality is already set up!
The mobile responsiveness is also being handled by some neat JS and Bulma classes, be sure to incorporate that view in your project goals!
As a non-registered user:
- I want to register for the App under my name
- I want to browse a list of all the places Pickle has reviewed
- I want to read an individual review from Pickle and see any other details about it
- I want to sort the places by Pickle's rating
As a registered user:
- I want to save reviews to a "Wishlist" so I can eat at that place too!
- I want to view my saved Wishlist
As a registered user:
- I want to add my own rating to the places Pickle has reviewed.
- I want to add my own comment/review beneath Pickle's review so I can share my experience.
- I want to see other user's reviews of the same place when viewing a review from Pickle.
- I want to browse the places Pickle has reviewed on a map.
As Pickle:
- I want a form only I, Pickle, can access so I can upload a new review.
name | purpose |
---|---|
Login | View for user to enter their login credentials |
Register | View for user to sign up |
Home | Welcome users and link to reviews |
Review | View a Pickle review of an individual place |
ReviewList | View the reviews Pickle has made |
SavedList | View places/reviews saved by the user |
ReviewMap | View the places reviewed on a map (Stretch) |
name | purpose |
---|---|
auth | Store information regarding user logins, auth status and auth errors |
reviews | Store the array of reviews (from db) |
saved | Store the array containing ids of saved reviews (from db) |
type | data | purpose |
---|---|---|
RECEIVE_REVIEWS | reviews | Follows retrieving the reviews from the server |
RECEIVE_SAVED | saved | Follows retrieving the ids of saved reviews from the server |
SAVE_REVIEW | id | For adding a new saved review |
Method | Endpoint | Protected | Usage | Response |
---|---|---|---|---|
Post | /api/auth/login | Yes | Log In a User | The Users JWT Token |
Post | /api/auth/register | Yes | Register a User | The Users JWT Token |
Get | /api/v1/reviews | No | Get the list of Pickle reviews | Array of Objects (object = a review) |
Get | /api/reviews/saved | Yes | Get the list of reviews a user has saved | Array of ints (int = an id) |
Post | /api/reviews/saved | Yes | Add a saved review to the db | 201 status code |
There should be three tables for MVP. You may want/need to add additional columns or tables.
Column Name | Data Type | Purpose |
---|---|---|
id | integer | Unique identifier for each review |
location | string | Name of the place reviewed |
title | string | Synopsis of the review for easy viewing |
text | text | Pickle's full review! |
rating | integer | Number from 1-5 of Pickle's approval |
date | date | When Pickle visited the place |
Column Name | Data Type | Purpose |
---|---|---|
id | integer | Unique identifier for each user |
username | string | Used for login |
email_address | string | So pickle can contact her fans 😉 |
hash | text | Hashed login password |
Column Name | Data Type | Purpose |
---|---|---|
id | integer | Unique identifier |
user_id | integer | Which user saved the review |
review_id | integer | Which review was saved |
Authentication is already set up in this project using the node module authenticare. Users are currently able to login, logout, and register and all user information will be stored in a table in our database.
If you wish to dive deeper on authenticare, docs are avalable here. Of particular note are getEncodedToken
and getTokenDecoder
as they deal with how you add a token to your request and secure server routes respectively.
Create your app with heroku create [name]
You can check that this was successful by running heroku apps
to view a list of your apps
Add postgresql (hobby dev) to your app at https://dashboard.heroku.com/apps/[APP NAME HERE]/resources
Check that pg has been added by running heroku addons
to ensure the postgresql db is on your app
I have created several npm scripts that will be useful for deploying your app to heroku easily.
To push your local master branch to your heroku app:
npm run h:deploy
Run heroku migrations:
npm run h:migrate
Run heroku seeds:
npm run h:seed
If ever you need to rollback, you can also:
npm run h:rollback
Your app should be deployed!