A simple CRUD web application to manage a contact book using Node.js and Express.
As of 1/14/2024:
- Used
friends-data.js
to populate the app. In the future, will try to use MongoDB. Add Friend
feature will be developed in the future. Only the page is rendering using the EJS view engine.
- View templates include:
- Home page to display a table of all friends' contact info.
- Add friend page.
- Gallery page.
- Router parameter used friend id
/friends/:id
to return a friend's details in JSON. - A button to use
res.download
method to download a gallery picture.
- Add, edit, and delete contacts.
- View a gallery of images.
/project-root
/routes
routes.js
/views
/layout
header.ejs
footer.ejs
add_friend.ejs
gallery.ejs
index.ejs
/images
squad.jpg
/data
friends-data.js
main.js
.env
.gitignore
README.md
Clone the repository:
git clone <repository-url>
Install dependencies:
npm install
Start the application:
npm start
Visit http://localhost:3000 in your web browser.
-
Home Page:
- URL: http://localhost:3000/
- Description: Displays a table of all friends' contact information.
- Template:
index.ejs
-
Friend Details by ID:
- URL: http://localhost:3000/friends/:id
- Description: Returns a friend's details in JSON format based on the provided friend ID.
-
Add Friend Page:
- URL: http://localhost:3000/add
- Description: Renders the "Add Friend" page.
- Template:
add_friend.ejs
-
Gallery Page:
- URL: http://localhost:3000/gallery
- Description: Renders the "Gallery" page.
- Template:
gallery.ejs
-
Download Image:
- URL: http://localhost:3000/download
- Description: Downloads the "squad.jpg" image using
res.download
.