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

Added Group 17's Final Deliverables #11

Open
wants to merge 78 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
ba4ec2a
added proposal
ksincaglia Sep 27, 2021
9b8b78b
setting files
Oct 4, 2021
2c7e125
addList and addItem pages
lewasserman Oct 6, 2021
5969d06
Added font
lewasserman Oct 6, 2021
de84f53
Small change
lewasserman Oct 6, 2021
28c6fa7
Another small change
lewasserman Oct 6, 2021
ae4bacd
add home page and list view page to repo
ksincaglia Oct 6, 2021
9a88074
server
lewasserman Oct 6, 2021
f1a641c
added logo
ksincaglia Oct 6, 2021
ae39da0
fixed formatting and added link
ksincaglia Oct 6, 2021
aa59ea0
db stuff
lewasserman Oct 6, 2021
1117ce0
more db stuff
lewasserman Oct 6, 2021
15c7797
created grid
ksincaglia Oct 7, 2021
2496521
db and server stuff
lewasserman Oct 7, 2021
48e528f
created grid
ksincaglia Oct 7, 2021
6a6d29c
more work on server db
lewasserman Oct 7, 2021
86a28b5
added images for home page to repo
ksincaglia Oct 8, 2021
4a56e3a
register functionality
Oct 9, 2021
727357e
added preloaded list item images
ksincaglia Oct 9, 2021
53ccba3
added images for the home page view
ksincaglia Oct 9, 2021
a455bed
deleted duplicate home image folder
ksincaglia Oct 9, 2021
0ddd08a
deleted home images (in wrong spot)
ksincaglia Oct 9, 2021
e9a0c39
added home page images
ksincaglia Oct 9, 2021
7bfbad1
updated home - added the pre loaded in list
ksincaglia Oct 9, 2021
5250a39
updated listview - added pre loaded items to list
ksincaglia Oct 9, 2021
787294b
Add List Works!
lewasserman Oct 9, 2021
ff5684f
changes
lewasserman Oct 9, 2021
26509d5
fixed register
Oct 9, 2021
c9ff1ae
add list and add item work
lewasserman Oct 9, 2021
c598d9e
login implemented
Oct 10, 2021
c0a69bf
bolded title
Oct 10, 2021
085c8ca
Merge branch 'carlos'
Oct 10, 2021
987b6f1
resolving merge conflicts
lewasserman Oct 10, 2021
7d03865
small change
lewasserman Oct 10, 2021
2391839
change to home
Oct 10, 2021
35d8cba
home page changes
Oct 10, 2021
07cfb6e
deleted white background logo
ksincaglia Oct 10, 2021
bc27803
added transparent background logo
ksincaglia Oct 10, 2021
3c83bb2
no idea
Oct 10, 2021
a0260ac
changes
Oct 10, 2021
836a934
deleting
ksincaglia Oct 10, 2021
3da01c2
uploading cropped version
ksincaglia Oct 10, 2021
29724eb
ahhhh
ksincaglia Oct 10, 2021
49f2482
finally correct
ksincaglia Oct 10, 2021
0c792f1
image funct
Oct 10, 2021
46c1ed1
image linking
Oct 10, 2021
0cbc53f
Changes for username showing
lewasserman Oct 10, 2021
9c29195
Merge branch 'main' of https://github.com/ksincaglia/final_project
lewasserman Oct 10, 2021
c76ae09
Trying to relink controllers/auth.js
lewasserman Oct 10, 2021
cb5c9c0
random stuff
Oct 10, 2021
f2d8de0
yes
Oct 10, 2021
ece40c7
home page lets go
Oct 10, 2021
23fca4c
homepage fix
Oct 10, 2021
bdc64da
in one line
lewasserman Oct 10, 2021
5be5953
currentUser is updated
lewasserman Oct 10, 2021
3281c35
changes to pages
Oct 10, 2021
c91f0b3
changes to pages
Oct 10, 2021
3dbc0b5
Trying to get the lists from the db
lewasserman Oct 11, 2021
1e7e63f
working on getting the correct lists
lewasserman Oct 11, 2021
63ea793
changes
Oct 11, 2021
7d04ceb
changes
Oct 11, 2021
cd5acb1
working kinda
lewasserman Oct 11, 2021
de43bcb
stuff
lewasserman Oct 11, 2021
96de2f2
stuff merging
lewasserman Oct 11, 2021
8cf1bda
Working on getting the lists show up
lewasserman Oct 11, 2021
4e492f1
LISTS ARE THEREgit add .git add .git add .
lewasserman Oct 11, 2021
6ce9e95
deploying test
Oct 11, 2021
ec09ab7
part of it
lewasserman Oct 11, 2021
5d742c4
merging
Oct 11, 2021
baa33de
work in progress on getting correct list for add item
lewasserman Oct 11, 2021
51dad77
trying to get currentList to work
lewasserman Oct 11, 2021
e47ae75
procfile
Oct 11, 2021
618a263
gitignorefile
Oct 11, 2021
06dff31
ahhhh
lewasserman Oct 11, 2021
a7a2e8a
Merge branch 'main' of https://github.com/ksincaglia/final_project
lewasserman Oct 11, 2021
d09c124
erd
lewasserman Oct 11, 2021
87286a9
updated README
ksincaglia Oct 11, 2021
d2e8486
added video
ksincaglia Oct 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DATABASE = heroku_0ee2d5e08f95874
DATABASE_HOST = us-cdbr-east-04.cleardb.com
DATABASE_USER = b36ca577f38674
DATABASE_PASSWORD = 9f0963f2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
npm-debug.log
Binary file added ERD for Webware Final Project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web:node server.js
43 changes: 31 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,40 @@ Submit a PR to turn it in by Monday, September 27th at11:59 PM. Only one pull re
There are no other scheduled checkpoints for your project.

#### Turning in Your Outline / Project
Submit a second PR on the final project repo to turn in your app and code. Again, only one pull request per team.
View the images here in google docs - https://docs.google.com/document/d/1bMv7plXMPmSIIITZAykPUUnefPlw9rqQ6PdeSVBhUtg/edit?usp=sharing

Deploy your app, in the form of a webpage, to Glitch/Heroku/Digital Ocean or some other service; it is critical that the application functions correctly wherever you post it.
We created a website where you can create wish lists for items you wish to buy in the future. The user can create different lists with different purposes (ex: one for clothes, one for shoes, etc). The user can add as many items to each list as wanted.

The README for your second pull request doesn’t need to be a formal report, but it should contain:
Our Video - https://drive.google.com/file/d/1DS-dRT9Af1Y_bTUl1H3uGYMcT-Vo766z/view?usp=sharing

1. A brief description of what you created, and a link to the project itself (two paragraphs of text)
2. Any additional instructions that might be needed to fully use your project (login information etc.)
3. An outline of the technologies you used and how you used them.
4. What challenges you faced in completing the project.
5. What each group member was responsible for designing / developing.
6. A link to your project video.
https://final-project-wishlist.herokuapp.com/ (sometimes the link doesn't work, let us know if it doesn't, please reach out to us via email or discord and we will redeploy it)

Think of 1,3, and 4 in particular in a similar vein to the design / tech achievements for A1—A4… make a case for why what you did was challenging and why your implementation deserves a grade of 100%.
To use the page: first, the user starts at a page where they can either log in or register an account. To register an account, you need to input a username and password (Image 1). The same information is then needed when you login after registering (Image 2). After logging in, the user is taken to the homepage. The homepage lists all of the current wish lists that the user has created(Image 3). There is also a button for the user to create a new list. When clicked, it takes you to a new page. It asks for a name for the new list, as well as a description of the list (Image 4). Then, once the information for the new list is submitted, you can head back to the home page by clicking the logo. Now, you can view all of the lists associated with your account (Image 5). If you click on one of them, you can see all of the items that have been added to the list. The page also includes a button to add a new item to the list. Once you click the add item button, it takes you to a new page. You must input the name of the item, where it is from, the link to the item, the price, and a picture of the item. Then, you return to the list page and see all of the items.

## FAQs
Image 1: Registering a New User

Image 2: Login Page

Image 3: Home Page for New User

Image 4: Adding a New List

Image 5: New List Added to Home Page

The only tip we have for our project is when you upload an item, make sure you have a picture downloaded - and it should be in a PNG format! Otherwise, you can just register yourself as a new user to log in and have fun!

We used an array of different technologies, middlewares and templating tools for our project. First of all, we used Handlebars to template and generate our HTML files. These .hbs files were stylized and templated with Bootstrap by using different components (e.x Jumbotron, cards, header, forms, and different form input types). The middleware packages used in this project were the following:
All post and get requests were done through app.get() and app.post() for easier routing
app.use(express.json()) to automatically convert incoming requests into json.
app.engine to enable handlebars
app.set to set my handlebars
app.use(express.static("public")) allows access to the rest of my files in public
Used bcrypt to hash and dehash user passwords
Our project’s database is set based on MySQL. We tried to use WPI’s SQL server, but this server would not allow us to deploy in Heroku. Therefore, we created a new database with the ClearDB MySQL add-on that Heroku provides. That way, once we modified our code to handle this new database, the deployment was successful.

With our project, we definitely faced a couple challenges. To start off, we had a few issues with the database, as well as learning the hard lesson that the WPI database only works when you are on campus using campus wifi. However, as mentioned before, the WPI SQL database stopped working for us anyway, so we created our own using ClearDB MySQL (which now works! yay). We also had a tough time working to get SELECT to send information from the database to javascript as well. The three members of our group are pretty new to Node.js, express, Bootstrap, and request/response methods. Some implementations and errors took more than others due to our novice experience with these technologies.

Carlos Velasquez - Carlos made the register user and log in pages and functionality, as well as hooked them up to the database. He templated the HTML files with Bootstrap, that would give them a cleaner look. He also deployed the app and database to Heroku.
Lauren Wasserman - Lauren, created an ERD and schema for the diagram, and set up the database and MySQL tables. She also handled the sql insert statements for adding lists and items to the database. The user can do this by accessing the addList and addItem pages, which she made. She has done a lot of the connecting of the front end to the server end, by implementing the GET/POST functions on the server side and in the js files for each html page that allow for the functionality of our page and handle the data that the user is storing, or has previously stored. Part of this involved making sure that the home screen displayed the correct lists created by the currentUser. She also worked on keeping track of the currentUser.
Kate Sincaglia - Kate came up with the overall theme for the site. This includes the font used, the color scheme, and the main design choices found all over the site (including creating the website logo). She also worked with the team to create the primary sketches of the site, as well as listing what needed to be included in each page (data and user input wise). She also did most of the writing.

- **Can I use XYZ framework?** You can use any web-based frameworks or tools available, but for your server programming you need to use Node.js. Your client-side scripting language should be either JavaScript or TypeScript.
94 changes: 94 additions & 0 deletions controllers/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const mysql = require("mysql");
const jwt = require('jsonwebtoken');
const bcrypt = require('bcryptjs');
const express = require('express')
const app = express();

app.use(express.json())
// app.listen(3000)

const db = mysql.createConnection({
host: process.env.DATABASE_HOST,
user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE
});


//LOGIN PAGE
exports.login = async (request, response) => {
try{

const{ username, password } = request.body;

User = () => {
return {username: username}
}

if(!username || !password ){
return response.status(400).render('login', {
message: 'Username and Password fields must be completed'
})
}

db.query( 'SELECT * FROM users WHERE username = ?', [username], async (error, results) => {
console.log(results);
if(!results || !(await bcrypt.compare(password, results[0].password))){
response.status(401).render('login', {
message: 'Username or Password is incorrect'
})
}else{
response.status(200).render('home', {suggesteduser: username});
}
});

} catch (error){
console.log(error);
}
}


//REGISTER PAGE
exports.register = (request, response) => {
console.log(request.body);

const {username, password, passwordConfirm} = request.body;

db.query('SELECT username FROM users WHERE username = ?', [username], async (error, results) => {
if(error){
console.log(error);
}

if(results.length > 0) {
return response.render ('register', {
message: 'Username already in use'
})
} else if ( password !== passwordConfirm) {
return response.render ('register',{
message: 'Passwords do not match'
})
}


let hashedPassword = await bcrypt.hash(password, 8);
console.log(hashedPassword);

db.query('INSERT INTO users SET ?', {username:username, password:hashedPassword}, (error, results) => {
if(error){
console.log(error);
} else {
return response.render('register', {
message: 'User registered successfully'
})
}
})


});

}

exports.logout = async (request, response) => {
response.status(200).render('index', {suggesteduser: null});
}

36 changes: 36 additions & 0 deletions db_connection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* const mysql = require('mysql');

const con = mysql.createConnection({
host: 'mysql.wpi.edu',
user: 'lauren',
password: 'n8njyP',
database: 'wishlist'
});

connection.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sqlUserTable = "CREATE TABLE Users ( username VARCHAR2(20) Primary Key, password VARCHAR2(30))";
var sqlListsTable = "CREATE TABLE Lists (listName VARCHAR2(30) Primary Key, description VARCHAR2(100), username VARCHAR2(20) References Users (username))";
var sqlItemsTable = "CREATE TABLE Items (itemName VARCHAR2(50) Primary Key, link VARCHAR2(300) Primary Key, price NUMBER(6,2), store VARCHAR2(30), picture VARCHAR2(100), listName VARCHAR2(30) References Lists (listName))";

connection.query(ssqlUserTableql, function (err, result) {
if (err) throw err;
console.log("User Table created");
});

cconnectionon.query(ssqlListsTableql, function (err, result) {
if (err) throw err;
console.log("Lists Table created");
});

connection.query(ssqlItemsTableql, function (err, result) {
if (err) throw err;
console.log("Items Table created");
});
}); */

// connection.connect((err) => {
// if (err) throw err;
// console.log('Connected!');
// });
1 change: 1 addition & 0 deletions node_modules/.bin/ejs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/handlebars

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/is-ci

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/jake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/.bin/node

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/.bin/node.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions node_modules/.bin/node.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/nodemon

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/nodetouch

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/nopt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/npm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/npm.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/npm.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/npx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/npx.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/npx.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/rc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/uglifyjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading