Repository to answer the back-end challenge homework for LSCS.
Tested for both Windows 10 and Ubuntu OS.
-
Node.js
-
Express.js
-
Mongoose and MongoDB
This is a brief explanation on how to submit data.
Creating a question uses to the /create
uri with the following request body to POST
:
{
question: string;
choices: string[];
correct_answer: string;
}
Updating a question uses to the /update
uri with the following request body where one of the new parameters are present to PATCH
:
{
original_question: string
new_parameters: {
question: string | null | undefined;
choices: string[] | null | undefined;
correct_answer: string null | undefined;
}
}
Delete a question requires to the /delete
uri with the following request body to DELETE
:
{
question: string;
}
Getting question data requires to the /get
uri with the following request body to POST
:
{
question: string;
}
Getting all questions requires to go to /list
uri with GET
.
Submitting a requires to go to /check_answer
uri with following to POST
:
{
question: string;
submitted_answer: string;
}
-
Install using
git clone https://github.com/ImaginaryLogs/LSCS-Homework.git
; -
Paste in a local MongoDB connection string in the
src/config/config.mts
file, or use .env file. -
Install the node modules via
npm i
. -
Go to the terminal and run the following command
npm run dev
in the root directory. -
Check the console if the database is connected.
- If not, please make sure you pasted the local MongoDB connection string.
-
Go to website outputted by the console to check the html file for testing.
-
You may also check the REST Client files.
-
You may also check the decapricated Python unittest file.
-