Document Details

WellEducatedSelkie3359

Uploaded by WellEducatedSelkie3359

University of Wollongong in Dubai

Tags

Node.js web development JavaScript MySQL

Summary

This document is a presentation on a Node.js project for a CSIT128 course at the University of Wollongong in Dubai. It covers topics like JavaScript Callbacks, building front and back-end code with HTML, JavaScript, Node.js, and MySQL, and provides instructions on installing modules, creating databases, and tables. The document also lists the required files and instructions for completing the project.

Full Transcript

University of Wollongong in Dubai CSIT128 – Introduction to Web Technology Node.js Part #3 2 Outline 1 JavaScript Callbacks 2 Node.js Project JavaScript Callbacks 4 JavaScript Callbacks A callback...

University of Wollongong in Dubai CSIT128 – Introduction to Web Technology Node.js Part #3 2 Outline 1 JavaScript Callbacks 2 Node.js Project JavaScript Callbacks 4 JavaScript Callbacks A callback is a function passed as an argument to another function. This technique allows a function to call another function. A callback function can run after another function has finished 5 JavaScript Callbacks Example: Click here to get the code 6 Node.js Project Classwork/Homework Support for the assignment 7 Node.js Project There is an example of a small Node.js Project. In this project, you will learn how you can build front and back- end code using HTML, JavaScript, Node.js, and MySQL. Node.js is part of the MEAN stack, and there are other frameworks that can work with Node.js to simplify and facilitate web development. Since not all the MEAN stack frameworks are included in this subject, you will learn in this project how you can use Node.js and some other web scripting languages you learnt in this subject. 8 Node.js Project The project includes the following web pages: 1. Login page. 2. Home page 3. User profile page. 4. Logout option 9 Node.js Project Login page 10 Node.js Project Home Page 11 Node.js Project User Profile Page 12 Node.js Project In order to run the project you need to install and create the following: 1. Install a module called express-session To install the module, run the Command Prompt, then go to node folder where you installed node.js by writing the command cd node, then you will be inside the folder node, and then write the command line NPM install express- session You should have your MySQL database on yous laptop as done in the lab 13 Node.js Project 2. You have to create a database called csit128_example You can create this database using MySQL workbench , or use the following file, which is also provide for you on Moodle named demo_db_example_create_db.js 14 Node.js Project 3. You have to create a table called employee You can create this database table using MySQL workbench , or use the this file, which is also provided for you on Moodle named demo_db_example_create_t able.js 15 Node.js Project 4. Insert the following record for a user and use it to test the project. A text file also provided on Moodle for this SQL statement and named insert record SQL command.txt INSERT INTO employee (emp_id, emp_f_name, emp_l_name, emp_email, emp_salary, emp_birthdate, emp_joining_date, emp_job_type,emp_gender, emp_username, emp_password) VALUES (4, 'Lana','Khaled','[email protected]',1500,'2001-07-07','2022-02- 01','Part Time','F','lana','123456’); The username & password to login to the project: Username: lana Password: 123456 16 Node.js Project 5. Download the project files from Moodle and copy the files to your node folder, and execute a file named demo_db_example_login.js using the command line node demo_db_example_login.js 17 Node.js Project The project files that you need once you execute the project are: 1. demo_db_example_login.js Don’t forget to change 2. myModule.js MySQL database password using yours in the first 3. mySession.js three file provided here. 4. login.html 5. homepage.html 6. userprofile.html 18 References 1. JavaScript Callbacks. https://www.w3schools.com/js/js_callback.asp Last Accessed 11/06/2023 2. Node.js MySQL. https://www.w3schools.com/nodejs/nodejs_mysql.asp. Last Accessed 11/06/2023 THANK YOU 20

Use Quizgecko on...
Browser
Browser