Skip to content

a3-Mahir-Sowad #73

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

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d116d3d
Ported all files from a2
mahirsowad3 Sep 17, 2023
042ccc9
Merge pull request #1 from cs-4241-2023/main
mahirsowad3 Sep 18, 2023
530873e
partial porting of server to express
mahirsowad3 Sep 22, 2023
321ce2b
post middleware
mahirsowad3 Sep 22, 2023
ddf6bde
getTasks route works
mahirsowad3 Sep 22, 2023
b50b8ea
delete route works
mahirsowad3 Sep 22, 2023
a675df9
use CSS framework
mahirsowad3 Sep 22, 2023
ff080c6
mongoDB integration started
mahirsowad3 Sep 23, 2023
d010c9c
successfully connected to mongodb
mahirsowad3 Sep 23, 2023
4db0335
cleanup
mahirsowad3 Sep 23, 2023
af4be96
fetching sample data from database successful
mahirsowad3 Sep 23, 2023
a10865d
setup of basic auth functionality + minor changes
mahirsowad3 Sep 24, 2023
308e2ea
hashing password
mahirsowad3 Sep 24, 2023
bec14aa
node engine updates
mahirsowad3 Sep 24, 2023
0cc330f
node engine
mahirsowad3 Sep 24, 2023
10202ec
node engine update
mahirsowad3 Sep 24, 2023
1d32b3e
login started
mahirsowad3 Sep 25, 2023
cbae45c
login finished
mahirsowad3 Sep 28, 2023
2a97528
redirect after login works
mahirsowad3 Sep 28, 2023
a3dca49
protect all routes when not logged in
mahirsowad3 Sep 28, 2023
36b5739
saves login session via cookies
mahirsowad3 Sep 28, 2023
8cc2396
some cleanup
mahirsowad3 Sep 30, 2023
16bdb41
get tasks for logged in user done
mahirsowad3 Sep 30, 2023
76bc5af
delete tasks work
mahirsowad3 Sep 30, 2023
a2e30a1
get tasks now calculates derived fields
mahirsowad3 Sep 30, 2023
d82d5ff
add tasks work
mahirsowad3 Sep 30, 2023
f35a450
Update tasks work now
mahirsowad3 Sep 30, 2023
fecbde3
updates username on main page
mahirsowad3 Sep 30, 2023
1eddfce
logout implemented
mahirsowad3 Oct 1, 2023
09f1b3a
add task clears form after
mahirsowad3 Oct 1, 2023
fbeb1a7
creates new user if username does not exist
mahirsowad3 Oct 1, 2023
27ad20c
redirect to login page for unauthenticated access of resources
mahirsowad3 Oct 1, 2023
4a08a7d
cleanup and bug fix
mahirsowad3 Oct 1, 2023
b2c2736
some meta tags to improve lighthouse score
mahirsowad3 Oct 1, 2023
82a67d9
README updates
mahirsowad3 Oct 1, 2023
5828244
Update README.md
mahirsowad3 Oct 1, 2023
ec2c1de
Update README.md
mahirsowad3 Oct 1, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
Binary file added LighthouseTestsAll100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 13 additions & 101 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,114 +1,26 @@
Assignment 3 - Persistence: Two-tier Web Application with Database, Express server, and CSS template
===
## TODO List Application

Due: September 25nd, by 11:59 AM.
Glitch Link: [https://a3-mahir-sowad.glitch.me/](https://a3-mahir-sowad.glitch.me/)

This assignnment continues where we left off, extending it to use the most popular Node.js server framework (express),
a database (mongodb), and a CSS application framework / template of your choice (Boostrap, Material Design, Semantic UI, Pure etc.)
This application uses express as the server backend and mongodb as the database. The server queries the database for all the tasks that belong to the currently logged in user using the default mongodb Collections API driver. The application allows the users to add, delete, modify / update tasks that they need to get done. It constantly shows all of tasks belonging to the current logged in user on the login page in a HTML table format. In order to edit, all of the current data related to the task is loaded back into the HTML form element and then the task information is updated to the database when the user clicks the "Update Task" button. Some challenges I faced were setting up the logic for some of the express routes and the mongodb database integration. I faced a lot difficulty setting up the login mechanism, especially in regards to saving the session cookie of the authenticated user, and protecting all of the routes that required authentication before accessing. The authetication strategy that I used was the basic username and password login because that seemed like the most feasible. The CSS framework that I used was the Simple.css framework because it had a simple and clean design that fit the organizational theme of my application well. I did not make any custom changes to override any of the CSS applied by the framework. The middleware packages I used were express-session to manage and store the authentication cookie on the client after the user has logged in. Other authentication middleware used was a middleware function that I created on my own called ensureAuthenticated which was placed before most routes other than the login route in order to prevent access without a valid session cookie. If the user tries to access a restricted resource, they are immediately redirected to the login page due to this middleware.

Baseline Requirements
---

Your application is required to implement the following functionalities:

- a `Server`, created using Express (no alternatives will be accepted for this assignment)
- a `Results` functionality which shows all data associated with a logged in user (except passwords)
- a `Form/Entry` functionality which allows users to add, modify, and delete data items (must be all three!) associated with their user name / account.
- Persistent data storage in between server sessions using [mongodb](https://www.mongodb.com/cloud/atlas) (you *must* use mongodb for this assignment).
- Use of a [CSS framework or template](https://github.com/troxler/awesome-css-frameworks).
This should do the bulk of your styling/CSS for you and be appropriate to your application.
For example, don't use [NES.css](https://nostalgic-css.github.io/NES.css/) (which is awesome!) unless you're creating a game or some type of retro 80s site.

Your application is required to demonstrate the use of the following concepts:

HTML:
- HTML input tags and form fields of various flavors (`<textarea>`, `<input>`, checkboxes, radio buttons etc.)
- HTML that can display all data *for a particular authenticated user*. Note that this is different from the last assignnment, which required the display of all data in memory on the server.

Note that it might make sense to have two pages for this assignment, one that handles login / authentication, and one that contains the rest of your application.
For example, when visiting the home page for the assignment, users could be presented with a login form. After submitting the login form, if the login is
successful, they are taken to the main application. If they fail, they are sent back to the login to try again. For this assignment, it is acceptable to simply create
new user accounts upon login if none exist, however, you must alert your users to this fact.
## How to Log In

CSS:
- CSS styling should primarily be provided by your chosen template/framework.
Oftentimes a great deal of care has been put into designing CSS templates;
don't override their stylesheets unless you are extremely confident in your graphic design capabilities.
The idea is to use CSS templates that give you a professional looking design aesthetic without requiring you to be a graphic designer yourself.

JavaScript:
- At minimum, a small amount of front-end JavaScript to get / fetch data from the server.
See the [previous assignment](https://github.com/cs-4241-23/shortstack) for reference.

Node.js:
- A server using Express and a persistent database (mongodb).

General:
- Your site should achieve at least 90% on the `Performance`, `Best Practices`, `Accessibility`, and `SEO` tests
using Google [Lighthouse](https://developers.google.com/web/tools/lighthouse) (don't worry about the PWA test, and don't worry about scores for mobile devices).
Test early and often so that fixing problems doesn't lead to suffering at the end of the assignment.

Deliverables
---
The application is designed to automatically create an account for any username that you type in if that username does not already exist in the database for the first time that someone logs in. If you would like to use a default demo account to access the application, please use these credentials provided here:

Do the following to complete this assignment:
username: testUser
password: testPass

1. Implement your project with the above requirements. I'd begin by converting your A2 assignment. First, change the server to use express. Then, modify the server to use mongodb instead of storing data locally. Last but not least, implement user accounts and login. User accounts and login is often the hardest part of this assignment, so budget your time accordingly.
2. If you developed your project locally, deploy your project to Glitch (unless completing the alternative server technical acheivement described below), and fill in the appropriate fields in your package.json file.
3. Test your project to make sure that when someone goes to your main page on Glitch (or an alternative server), it displays correctly.
4. Ensure that your project has the proper naming scheme `a3-yourfirstname-yourlastname` so we can find it.
5. Fork this repository and modify the README to the specifications below.
6. Create and submit a Pull Request to the original repo. Name the pull request using the following template: `a3-firstname-lastname`.
## Technical Achievements

Acheivements
---
- **Tech Achievement 1**: I got a 100% on all four Lighthouse tests (at least on localhost)

Below are suggested technical and design achievements. You can use these to help boost your grade up to an A and customize the
assignment to your personal interests, for a maximum twenty additional points and a maximum grade of a 100%.
These are recommended acheivements, but feel free to create/implement your own... just make sure you thoroughly describe what you did in your README,
why it was challenging, and how many points you think the achievement should be worth.
ALL ACHIEVEMENTS MUST BE DESCRIBED IN YOUR README IN ORDER TO GET CREDIT FOR THEM.
![Lighthouse test results](LighthouseTestsAll100.png "Lighthouse tests results")

*Technical*
- (10 points) Implement OAuth authentication, perhaps with a library like [passport.js](http://www.passportjs.org/).
*You must either use Github authenticaion or provide a username/password to access a dummy account*.
Course staff cannot be expected, for example, to have a personal Facebook, Google, or Twitter account to use when grading this assignment.
Please contact the course staff if you have any questions about this. THIS IS THE HARDEST ACHEIVEMENT OFFERED IN WEBWARE. You have been warned!
- (5 points) Instead of Glitch, host your site on a different service like [Heroku](https://www.heroku.com) or [Digital Ocean](https://www.digitalocean.com). Make sure to describe this a bit in your README. What was better about using the service you chose as compared to Glitch? What (if anything) was worse?
- (5 points) Get 100% (not 98%, not 99%, but 100%) in all four lighthouse tests required for this assignment.
### Design/Evaluation Achievements

*Design/UX*
- (10 points) Make your site accessible using the [resources and hints available from the W3C](https://www.w3.org/WAI/), Implement/follow twelve tips from their [tips for writing](https://www.w3.org/WAI/tips/writing/), [tips for designing](https://www.w3.org/WAI/tips/designing/), and [tips for development](https://www.w3.org/WAI/tips/developing/). *Note that all twelve must require active work on your part*.
For example, even though your page will most likely not have a captcha, you don't get this as one of your twelve tips to follow because you're effectively
getting it "for free" without having to actively change anything about your site.
Contact the course staff if you have any questions about what qualifies and doesn't qualify in this regard.
List each tip that you followed and describe what you did to follow it in your site.
- (5 points) Describe how your site uses the CRAP principles in the Non-Designer's Design Book readings.
Which element received the most emphasis (contrast) on each page?
How did you use proximity to organize the visual information on your page?
What design elements (colors, fonts, layouts, etc.) did you use repeatedly throughout your site?
How did you use alignment to organize information and/or increase contrast for particular elements.
Write a paragraph of at least 125 words *for each of four principles* (four paragraphs, 500 words in total).
None

Sample Readme (delete the above when you're ready to submit, and modify the below so with your links and descriptions)
---

## Your Web Application Title

your glitch (or alternative server) link e.g. http://a3-charlie-roberts.glitch.me

Include a very brief summary of your project here. Images are encouraged, along with concise, high-level text. Be sure to include:

- the goal of the application
- challenges you faced in realizing the application
- what authentication strategy you chose to use and why (choosing one because it seemed the easiest to implement is perfectly acceptable)
- what CSS framework you used and why
- include any modifications to the CSS framework you made via custom CSS you authored
- the five Express middleware packages you used and a short (one sentence) summary of what each one does. If you use a custom function for *one* (and one alone) middleware please
add a little more detail about what it does.

## Technical Achievements
- **Tech Achievement 1**: I used OAuth authentication via the GitHub strategy

### Design/Evaluation Achievements
- **Design Achievement 1**: I followed the following tips from the W3C Web Accessibility Initiative...
### Note: I have been given an extension approved by Professor Roberts
Loading