First clone the repository to your station
git clone https://github.com/PVNETEdu/Software-Engineer---Program-Assignment-1.git
Be sure to add the base repository as one of your remote since I might update README
git remote add projectDescription https://github.com/PVNETEdu/Software-Engineer---Program-Assignment-1.git
To keep updated to of the assignment, update your project
git pull projectDescription master
Create a new branch with your name and start working
git checkout -b <your name>
Check if you are on your branch
git branch
First we need to install all of the npm dependencies run:
npm install
To check everything worked well, go to localhost:3000 to check if you see the web page:
cd bin
- run:
node www
to run the server file - put:
localhost:3000
in the browser and check if you see web app works.
For this assignment, you will be learning to get familiar with the normal ways of how to use an express app with a frontend view engine.(in this case, embeded javascript)
In the server database, I created one database called nicole, you should use the one that is your name in the project.
Files to complete
Part One: Get Started
Part Two: Attach Mysql
Part Three: Make the Login System
Part Four: Make the login page and the routes
Part Five: Finish the authenticateUser POST Request
Part Six: Finish the signup page
Part Seven: Finish the registerUser POST Request
Part Eight: Commit and Submit
app.jd - The express app setup
index.js - The index router with four different routes
views - The folder that contains your front-end engine there are four files in total needed
You should import it to your IDE of choice WebStorm recommended.
By default, your project should have no errors and contain the following root items:
bin - The folder that includes the starter code on starting server with the port number
node_modules - The library for all of the npm packages.
public - The public folder where the page elements like stylesheet, in page javascripts, and images can go to
routes - The folders that have the index routes and user routes that we can use
views - The folder that contains your front-end engine
app.js - The express app setup file
package.json - This is all the dependencies that NPM will look into when you install or delete packages
package-lock.json - Describes the exact tree that was generated by NPM
Please seek help from me or any course staffs if you are missing any of these files
First briefly read through the entire project description,and think about how many tables
you need for completing this project, also think about what fields goes into each of these
tables. After that, in your own database, make the tables you need using the CREATE TABLE tableName ()
command to create the necessary tables and fields along with it. NOTICE: you should name
the tables in the most meaningful way.
Look into app.js
file the mysql connection was already done for you! All you have to do is to fill in the username of your localhost mysql account, the password, and the database your tables are stored in.
Here are the mysql information: fill it in in app.js
HOST=pvnet-testing.cjdmtmc8kuwg.us-west-1.rds.amazonaws.com
DATAPORT=3306
DATAUSER=pvnetuser
PASSWORD=CDy21xM8c9NA
DATABASE=nicole
To check if the your configuration was successful, run the web app, if you got connecting success
that means the connection to mysql was successful, otherwise play around with the database configuration JSON until you got it correct.
In the index.ejs page make two buttons, one named login
, and one named signup
login
button - will call the /login
GET request in the backend that renders to a page with an input of email address, and an input of password, you can name this page whatever you want.
signup
button - will call the /signup
GET request in the backend that renders to a page with a form that ask for email and password.
In the views folder make another page called login with the appropriate file extension. This page should have a form that submits to the POST /authenticateUser
route
Build the route that will take the form's API call, and compare with the user table in the database using a reasonable query.
The form should contain two input boxes, one of them takes int the email address, and one of them takes in the password.
Once the authentication of the user passed, go ahead and send the user JSON object for that specific user to the browser using the response
object.
All of the inputs you built in the previous part will be passed into this post command in the req.body, do the appropriate query in your database if the password and information all matched up, end the response with the user's information JSON. Otherwise end the response with an error message of your design.
In the views folder make another page called signup with the appropriate file extension. This page should have a form that submits to the POST /registerUser
route
Build the route that will take the form's API call, and compare with the user table in the database using a reasonable query.
The form should contain input boxes, with email address, password and repeat password(make sure the two passwords are the same)
Finish your registerUser post request check the database if the user already exists, then do not do this insert return a Same email address found
response. Otherwise, insert the user in the table and return a register successful
response.
Once you have finished all the works and ready to submit your assignment, make a new pull request for merging into master and @PVNetEdu me as a reviewee so I will know that your code is ready to be reviewed.