-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from CS3219-AY2223S1/glenn/readme
Add readme for question service
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Question Service | ||
|
||
## Overview | ||
|
||
Question service leverages [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/) as a HTML Parser/Web Scraper, used on [this webpage](https://bishalsarang.github.io/Leetcode-Questions/out.html). The HTML parsed is then stored as a string in our database, using [html-react-parser](https://github.com/remarkablemark/html-react-parser) to convert the HTML string to DOM elements. | ||
|
||
On top of that, it provides an **additional** comment/discussion section, which is meant to act as a discussion space for users to discuss potential solutions or give insights. | ||
|
||
# Set Up Guide | ||
|
||
## Navigate to the `question-service` directory | ||
|
||
Run `cd question-service` from the root of the project. | ||
|
||
## Installing Dependencies | ||
|
||
Run `npm install` to install dependencies | ||
|
||
## Running Locally | ||
|
||
1. After installing dependencies, run `npm run dev` to start the application. | ||
2. The service should be started on http://localhost:8002. | ||
|
||
## Running Tests | ||
|
||
Run `npm run test` to execute tests. | ||
|
||
# Endpoints | ||
|
||
## Getting all existing questions | ||
**GET** request to http://localhost:8002/api/question/question. | ||
|
||
## Getting a question based on the title | ||
**GET** request to http://localhost:8002/api/question/question/:title | ||
|
||
Example: | ||
**Title**: Two Sum | ||
**Endpoint**: http://localhost:8002/api/question/question/two-sum | ||
|
||
## Adding a new question to the database | ||
**POST** request to http://localhost:8002/api/question/question | ||
|
||
Example request body: | ||
```js | ||
{ | ||
title: 'Title', | ||
description: 'Description', | ||
difficulty: 'Easy' | ||
} | ||
``` | ||
|
||
## Adding a new comment to a question | ||
**POST** request to http://localhost:8002/api/question/question/:title | ||
|
||
Example: | ||
**Title**: Two Sum | ||
**Endpoint**: http://localhost:8002/api/question/question/two-sum | ||
**Request body**: | ||
```js | ||
{ | ||
user: 'User', | ||
comment: 'Comment' | ||
} | ||
``` |
cb4469d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
frontend – ./
frontend-cs-3219-g55.vercel.app
frontend-git-main-cs-3219-g55.vercel.app
frontend-lemon-one.vercel.app