For this project you are tasked with developing a full stack web app for students to browse available courses and add manage their own course list. You will also be including a very basic (and incredibly insecure) authentication system to manage user accounts.
The project is split into two sections: the backend ExpressJS API server and the frontend web app it hosts. The server requirements come with automatic Jest test to help you focus on the functionality of the server without needing to mock out the frontend. Then it is up to you to design and develop the frontend to make use of your working API server (within the assignment requirements).
- Make a copy of this template repo and clone your version to your computer
- Open the cloned folder in VSCode and run
npm installin your terminal to download the dependencies - Write all your backend code in
app.js, the frontend files should all live in thePublicfolder - Run your server locally either by running
npm run servein the terminal, which will runserver.jswith nodemon. The provided structure of app.js exporting the express app for server.js to actually use is important for the automated tests to work, please don't modify this - Run the automated tests with either
npm run testor with theJest Test ExplorerVSCode Extension
- Backend code written in JavaScript using Node and Express which exposes the endpoints detailed below and tested by
server.test.js - "Database" made with basic JSON files in the
databasefolder - Frontend code using HTML, JavaScript, and/or CSS (or additional frontend tools like Svelte, Vue, Tailwind, etc) which queries and displays data from the server as well as 'posting', 'patching', or 'deleting' data as outlined below
- reference the tests for all status code requirements
- respond with array of all course objects
- support query string to filter by code (eg
?code=TECH), or by num (eg.?num=1for all 1XXX courses or?num=1101for any 1101 course)
- respond with user object
{user: {username: ... , courses: [...], id: ...} } - if ID does’t exist, respond with error message
{error: ...}
- body: username and password
- if username and password match a user, respond with
{userId: ...} - otherwise respond with error message
{error: ...}
- body: username and password
- if username not currently in use, add username and password with new ID to users database
- respond with
{userId: ...}
- body: course object
- if course object doesn't exist or doesn’t have code, title, and description, respond with error message
- if id doesn’t match a user, respond with error message
- if course was already in users course list, respond with error message
- otherwise add it, respond with updated course list
- body: course object
- if course object doesn't exist or doesn’t have code, title, and description, respond with error message
- if id doesn’t match a user, respond with error message
- if course was in users course list, remove it from the user's record in the database and respond with the updated course list
- requests /courses and displays them all
- ui to add filter params, rerequest /courses with query
- courses list shows course code, num, title and description
- if "logged in" (see below), course list items also have “Add” button
- Add button sends patch request to /account/:id/courses/add with course object
- If success, display success message
- if unsuccessful, display error message
- Login/Logout Button
- Login links to Login page
- Logout removes user ID from session storage
- If Logged in, Account Button
- links to Account page
- Username and password form, posts to /login
- if response contains ID, store ID in session storage
- if response ID is null, display error text
- link to Sign Up page
- username, password, & confirm password form
- on submit, first verify password and confirm password match and are not empty, then post to /signup
- if response contains userId, store ID in session storage
- if response userId is null, display error text
- link to Login Page
- If no ID in session storage, redirect to Home
- Otherwise, request account data from /account/:id (ID from session storage)
- Display username and user’s course list from response
- Course list items contain code, num, title, description, and “Remove” button
- Remove button sends patch request to /account/:id/courses/remove with course object
- Refresh list UI with updated list