Lab
PROG 3017 LAB 2B
FULL STACK DEVELOPMEMNT
Prerequisites
Make sure that your [Link] 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 [Link] Tutorial for Beginners: Learn Node in 1 Hour |
Mosh ([Link] ). Pay particular attention to the section where you will
create your own custom module. (Starting at 22:53 - [Link] )
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 [Link], 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 - [Link]
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 [Link]. 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 [Link] 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 [Link], import the textNinja module and demonstrate usage of it within the
application.
Step 3 – Using Third-party Modules, NPM and [Link]
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 [Link]
1. Install and execute the node module called builtin-modules
( [Link] ).
Demonstrate how to use this module with an accompanying code sample.
2. Install and execute the accompanying module called is-builtin-module
( [Link] ) at the bottom of the same
page. Demonstrate how to use the module.
3. Install and execute the module called validator
( [Link] ). Demonstrate how to use this
module with a code sample.
4. Install and execute the module called dayjs
( [Link] ). Demonstrate how to use this module
with a code sample.
5. Install and execute the node module called sqlite3
( [Link] )
Demonstrate how to use this module by connecting to the [Link] database
file provided in your cloned repository and by displaying some data in the
console.
6. Install and execute the node module called axios
( [Link] ) with a code sample.
7. Install and execute the node module called nodemailer.
( [Link] ) 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 [Link] 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