- Navigate to the backend directory:
cd backend
- Install dependencies:
npm install
- Create a
.env
file in the backend directory and add the following environment variables:REDIS_URL=redis://localhost:6379 PORT=3000 SUPABASE_URL=https://tdpgskzzgxitjofcunyh.supabase.co SUPABASE_KEY=
- Start the backend server:
npm run dev
- Mac:
redis-server
- Windows:
redis-server.exe
- Navigate to the frontend directory:
cd frontend
- Install dependencies:
npm install
- Start the frontend development server:
npm run dev
- URL:
GET https://emkc.org/api/v2/piston/runtimes
- URL:
POST https://emkc.org/api/v2/piston/execute
- Example Request:
{ "language": "python", "version": "3.10.0", "files": [ { "name": "dummy.py", "content": "a = 5\nb = 5\nprint(a + b)" } ] }
To start the de-queue process to dequeue from Redis and send responses to Piston. The response will be logged onto your console.
node sendPostRequestToPiston.js
-
Sign Up
- URL:
POST /user/signup
- Body:
{ "username": "string", "email": "string", "password": "string" }
- Response:
{ "message": "Account created successfully" }
- URL:
-
Sign In
- URL:
POST /user/signin
- Body:
{ "email": "string", "password": "string" }
- Response:
{ "token": "string" }
- URL:
-
Get All Questions
- URL:
GET /question/
- Response:
[ { "id": "string", "title": "string", "description": "string", "difficulty": "string", "category": "string", "timeLimit": "string", "acceptance": "string" } ]
- URL:
-
Get Question by ID
- URL:
GET /question/:id
- Response:
{ "id": "string", "title": "string", "description": "string", "difficulty": "string", "category": "string", "timeLimit": "string", "acceptance": "string", "example_input": "string", "expected_output": "string", "constraint_data": "string" }
- URL:
-
Add New Question
- URL:
POST /question/
- Body:
{ "title": "string", "description": "string", "difficulty": "string", "category": "string", "timeLimit": "string", "acceptance": "string", "exampleInput": "string", "expectedOutput": "string", "constraint_data": "string" }
- Response:
{ "message": "Question added successfully" }
- URL:
-
Create Task
- URL:
POST /task
- Body:
{ "code": "string", "language": "string", "questionId": "string", "action": "run" | "submit", "userId": "string", "stdin": "string", "output": "string" }
- Response:
{ "taskId": "string" }
- URL:
-
Get Task Result
- URL:
GET /task/:taskId
- Response:
{ "status": "completed" | "failed" | "pending", "output": "string" }
- URL:
- Route:
/user/signup
- Component:
SignUp
- Description: Provides a form for user registration.
- Route:
/user/signin
- Component:
SignIn
- Description: Provides a form for user login.
- Route:
/questions
- Component:
QuestionsList
- Description: Displays a list of all questions.
- Route:
/addquestion
- Component:
AddQuestionForm
- Description: Provides a form to add new questions.
- Route:
/solve/:questionId
- Component:
TaskFetcher
- Description: Fetches and displays question details, allows code submission and execution.
{
"id": "string",
"title": "string",
"description": "string",
"difficulty": "string",
"category": "string",
"timeLimit": "string",
"acceptance": "string",
"example_input": "string",
"expected_output": "string",
"constraint_data": "string"
}
{
"taskId": "string",
"code": "string",
"language": "string",
"questionId": "string",
"action": "run" | "submit",
"userId": "string",
"stdin": "string",
"output": "string"
}
{
"username": "string",
"email": "string",
"password": "string"
}