Skip to content

Repository files navigation

Skills Network steps

Finish Populating MongoDB

Clone your repository
Go to import-mongo folder
cd /home/project/fullstack-capstone-project/giftlink-backend/util/import-mongo

Duplicate the .env.sample file, naming the new file .env.
This file contains the username and password for MongoDB.
MONGO_URL=mongodb://root:password_of_mongodb_instance@localhost:27017
Change localhost with IP address otherwise it could happen that it won't work.

Testing the code:

  • .env file --> mongodDB pw
  • new terminal --> cd backend directory
  • npm install
  • npm start
  • launch application in port 3060
  • in giftlink-frontend .env file --> paste url from launching step in there
  • new terminal go to giftlink-frontend
  • npm install
  • npm run build
  • npm start
  • launch application in port 3000
    Note (if it does not work):
    npm install in backend
    In giftlink-backend install npm install dotenv
    npm start in backend
    npm install in frontend
    npm start in frontend

select "MongoDB CLI" in Skills Network Lab and open a new terminal (directing to import-mongo folder).

Select MongoDB CLI
show databases
use giftdb
show collections
db.gifts.countDocuments() --> result: 16
db.gifts.find({category: 'Living Room'}).limit(2) --> result: 2 objects: Coffe Table and Couch
db.gifts.find({id: '429'}) --> result: 1 object: Side Table

Introduction: Back-end APIs and Services

  • Several APIs with appropriate endpoints.
  • Middleware to handle requests from the front end.
  • Integrate gift routes into the main Express application by configuring the middleware
  • Express server performs sentiment analysis (anaylzes language to categorize the language as positive, negative, or neutral) by calling external service.

Design and Implement Gift Listings

The gifts API handles the routes and endpoints for retrieving all gifts or specific gifts by their ID.
connectToDatabase():

  1. Connect to MongoDB
  2. Assign database instance
  3. Return the database instance

/api/gifts endpoint is implemented so it retrieves the gifts stored with a get() function.
/api/gifts/:id

Design and Implement Search API

The search API will contain the search endpoint that allows filtering gifts by name, category, condition, and age.
searchRoutes.js

  1. Connecting to MongoDB
  2. Adding the name filter to the query
  3. Adding other filters to the query such as category, condition, and age.
  4. Fetching the filtered gifts
  5. Integrating the search routes in the Express application
  6. Importing searchRoutes
  7. Using searchRoutes for the api/search path

Build a Sentiment Analysis Service Lab

Express server that performs sentiment analysis by calling an external service. Natural library using the node package manager (npm).

  1. Initialize an Express server with the necessary middleware
  • cd /home/project/fullstack-capstone-project/sentiment
  • npm install natural
  1. Create a POST /sentiment endpoint
  • app.post('/sentiment', async (req, res)
  1. Extract the sentence parameter from the request body
  • const { sentence } = req.body;
  1. Call the external sentiment analysis service using Axios
  2. Process the external service's response and return the analysis result
  3. Implement error handling for the Axios request
  4. Add logging for request processing and errors

Landing page and home page

  • HTML, CSS and React components used
  • main page which displays all the gifts
  • React components
  • main page (home.html, home.css)
  • navigation (MainPage.js, Navbar.js)
  • register (manage form input states for user details, first name, last name, email, password)
  • login (manage form input states for user details, first name, last name, email, password)
  • details (details about gifts, user comments, only logged users can access, authentication check, error message)
  • search (fetch and display search results from API from other lab, user can search includ text-based input, age range, category, and condition of item)

The Landing Page

  • Applying Bootstrap classes
  • Modifying and Adding missing HTML elements in giftlink-frontend/public/home.html.

MainPage and Navbar

Register and Login Pages

Details Page

Search Page

Authetnication

Develop Register API

Develop Login API

Develop Profile API

Develop Register API

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages