learn-in-web-backend

learn-in-web-backend

Learn In Web Backend.

6b178db3 Fix Runner Output Error. · by sungjin


Logo

Learn In Web(Backend)

NestJS Backend for Learn In Web
View Demo »

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

Product Name Screen Shot

This project allows users to run codes and study without any IDE. This project focusd on schools, and students for study.

Why we need this project? :

In Korea, learning programming is essential in school. So students wants to learn programming in school; however it is difficult for students to study programming without computer.

So run this project in school server, and allow students to access this page. So they can study, and run code only with phone, or tablet.

(back to top)

Built With

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
  npm install npm@latest ts-node -g
  • Compiler for languages
    #For typescript
    npm install -g ts-node
    #Ubuntu, Debian Based
    sudo apt update && sudo apt install golang build-essential
    #RedHat Based
    sudo yum update && sudo yum install golang build-essential
    #Other
    #install golang, cpp, c++ manually.
  • Docker, postgreSQL Database

(You can manually change port, name, etc if you want.)

```sh
#Install docker for your OS. ex) sudo apt install docker
docker pull postgres
docker run -d -p 5432:5432 --name postgres-container -e POSTGRES_PASSWORD=Your_Password -v ~/pgdata:/Location_to_save_data/ postgres 
```
  • Installation
  1. Clone the repo

    git clone http://khuhub.khu.ac.kr/2021105619/learn-in-web-backend
    
  2. Install NPM packages

    npm install
    
  3. Enter your DB URL in .env

    DATABASE_URL="postgresql://_User:_Password@localhost:5432/postgres"
    
  4. Migrate DB

   npx prisma migrate dev
  1. Start Server.
   nest start

(back to top)

Usage

To Use Learn In Web, you need to use this backend; this project communicate via RESTful API.

-API-

POST /auth/signup
{
  "name" : "name",
  "email" : "email",
  "password" : "password"
}
POST /auth/signin
{
  "email" : "email",
  "password" : "password"
}
POST /auth/refresh
{
  "token" : "token_madeby_signup_or_signin"
}
POST /auth/validate
{
  "token" : "token_madeby_signup_or_signin"
}
POST /post
{
  "token" : "token",
  "title" : "title",
  "privat" : true,
  "explain" : "explain of problem",
  "testinput" : ["1", "2"],
  "testoutput" : ["3", "4"],
  "difficulty" : 1
}
PUT /post
{
  "token" : "token",
  "title" : "title",
  "privat" : true,
  "explain" : "explain of problem",
  "testinput" : ["1", "2"],
  "testoutput" : ["3", "4"],
  "difficulty" : 1
}
GET /post

GET /post/some
{
  "take" : 20
}
GET /post/id/:id
use integer param for :id
GET /post/difficulty/:level
use integer param for :level
POST /post/like/:id
use integer param for :id
{
    "token" : "token"
}
DELETE /post
POST /comment/:id
use integer param for :id
{
  "token" : "token",
  "content" : "content of comment"
}
DELETE /comment/:id
use integer param for :id
{
  "token" : "token"
}
GET /comment/:id
use integer param for :id
POST /search
{
  "search" : "search item divided by black" 
}
POST /runner
{
  "token" : "token",
  "input" : ["input", "data", "array", "does not working now"],
  "type" : "cpp",
  "code" : "//example code\n#include <iostream> ~~~~"
}

For Real Useage, please see frontend Frontend_URL

(back to top)

Roadmap

  • Add README
  • Add How to Use for new user
  • Add Saving with DB
  • Multi-language Support

    • English
    • Japanese
  • View code run time

  • Add competition between users with runtime.

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/newFeature)
  3. Commit your Changes (git commit -m 'Add some newFeature')
  4. Push to the Branch (git push origin feature/newFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License.

(back to top)

Contact

SungJin - @taintlesscupcake - email

Project Link: http://khuhub.khu.ac.kr/2021105619/learn-in-web-backend

(back to top)

(back to top)