0% found this document useful (0 votes)
16 views3 pages

PROG3017 FullStack Lab2b

Uploaded by

absolutigahiga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

PROG3017 FullStack Lab2b

Uploaded by

absolutigahiga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab

PROG 3017 LAB 2B


FULL STACK DEVELOPMEMNT

Prerequisites
Make sure that your Node.js development environment is set up as per the instructions in
class and that Node and npm are both available.

Using the link on Brightspace, make sure you clone down the Lab2b Github Classroom
repository. You will do all of your work in the repository.

Instructions
Step 1- Custom Modules
Create all required files for this section in a folder that you create called Step1.

Watch the introductory video entitled Node.js Tutorial for Beginners: Learn Node in 1 Hour |
Mosh (https://youtu.be/TlB_eWDSMt4 ). Pay particular attention to the section where you will
create your own custom module. (Starting at 22:53 - https://youtu.be/TlB_eWDSMt4?t=1373 )

1. Using the example that is created in the video for creating your own module, create a
module called primeNumberChecker that does the following.
a. Exports a function called isPrime which takes in a number as an argument and
returns true or false depending on whether it is a prime number or not. You can
search online for an example of prime number checking that you can use in the
module.
2. In a file called app.js, import the primeNumberChecker module and demonstrate usage of
it within the application.

Step 2 – Using the built-in File System Module


Create all required files for this section in a folder that you create called Step2.

W3Schools - https://www.w3schools.com/nodejs/nodejs_filesystem.asp

Using the built-in File System (fs) module.


1. Using the example that is demonstrated in the video for creating your own module and
the examples shown for the built-in File System (fs) module, create a custom module file
called textNinja.js. This module should export one function called addToText. This
function should perform according to the following guidelines.
 It receives two arguments, fileName and textToAdd.
 If the file name specified does not exist, it should create the file in the same
location as the textNinja.js module file itself.

Semester- Fall Year- 2024/2025 1 of 3


Lab
 If the file exists, it should simply open the file and append whatever text string
was passed in as the second argument to the function.
2. In a file called app.js, import the textNinja module and demonstrate usage of it within the
application.

Step 3 – Using Third-party Modules, NPM and package.json


Create all required files for this section in a folder that you create called Step3.
This section asks you to explore the concept of modules and asks you to become familiar with
importing in 3rd-party modules and using them for various purposes. Remember that the steps
and instructions to use the modules are well documented on the module home pages on the npm
web site https://www.npmjs.com

1. Install and execute the node module called builtin-modules


( https://www.npmjs.com/package/builtin-modules ).
Demonstrate how to use this module with an accompanying code sample.

2. Install and execute the accompanying module called is-builtin-module


( https://www.npmjs.com/package/is-builtin-module ) at the bottom of the same
page. Demonstrate how to use the module.

3. Install and execute the module called validator


( https://www.npmjs.com/package/validator ). Demonstrate how to use this
module with a code sample.

4. Install and execute the module called dayjs


( https://www.npmjs.com/package/dayjs ). Demonstrate how to use this module
with a code sample.

5. Install and execute the node module called sqlite3


( https://www.npmjs.com/package/sqlite3 )
Demonstrate how to use this module by connecting to the chinook.db database
file provided in your cloned repository and by displaying some data in the
console.

6. Install and execute the node module called axios


( https://www.npmjs.com/package/axios ) with a code sample.

7. Install and execute the node module called nodemailer.


( https://www.npmjs.com/package/nodemailer ) Implement the sample code to
send yourself an email message from the module when it is run in node.

8. Implement three(3) other node modules of your choosing and be prepared to


describe how they work with a working example. Search online via npm or
related material for a list of available npm modules (there are thousands!)

Semester- Fall Year- 2024/2025 2 of 3


Lab

Step 4 – Demonstrate debugging in Visual Studio Code


Using the article at https://code.visualstudio.com/docs/nodejs/nodejs-debugging, demonstrate
that you can set a breakpoint on any of the code that you have written for this lab.

Semester- Fall Year- 2024/2025 3 of 3

You might also like