Giter VIP home page Giter VIP logo

swe-training-proj-1's Introduction

Programming Assignment 1 - Express with MYSQL

Get & setup the repository(assignment)

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

  1. run: node www to run the server file
  2. put: localhost:3000 in the browser and check if you see web app works.

Note: for this project, it will not work until you set up the mysql configuration.

Overview

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)

Important:

In the server database, I created one database called nicole, you should use the one that is your name in the project.

Table of Contents

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

Files to complete:

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

Part One: Get Started

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

Part Two: Attach Mysql

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.

Part Three: Make the Login System

This part of the program will not be graded on prettiness

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.

Part Four: Make the login page and the routes

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.

Part Five: Finish the authenticateUser POST Request

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.

Part Six: Finish the signup page

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)

Part Seven: Finish the registerUser POST Request

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.

Part Eight: Commit and Submit

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.

Grade: /100

swe-training-proj-1's People

Contributors

mingkaili avatar fuzzypicklz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.