Skip to content

Commit

Permalink
Merge pull request #112 from CS3219-AY2223S1/glenn/readme
Browse files Browse the repository at this point in the history
Add readme for question service
  • Loading branch information
glennljw authored Nov 9, 2022
2 parents 3c39d4a + 365d2af commit cb4469d
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions question-service/README.md
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'
}
```

1 comment on commit cb4469d

@vercel
Copy link

@vercel vercel bot commented on cb4469d Nov 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.