Table of Contents
About The Project
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.
Built With
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
-
Clone the repo
git clone http://khuhub.khu.ac.kr/2021105619/learn-in-web-backend
-
Install NPM packages
npm install
-
Enter your DB URL in
.env
DATABASE_URL="postgresql://_User:_Password@localhost:5432/postgres"
Migrate DB
npx prisma migrate dev
- Start Server.
nest start
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
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).
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/newFeature
) - Commit your Changes (
git commit -m 'Add some newFeature'
) - Push to the Branch (
git push origin feature/newFeature
) - Open a Pull Request
License
Distributed under the MIT License.
Contact
SungJin - @taintlesscupcake - email
Project Link: http://khuhub.khu.ac.kr/2021105619/learn-in-web-backend