Giter VIP home page Giter VIP logo

ojproject-old's Introduction

Online Judge


개요

json 형태의 데이터를 주고받아 문제를 푸는 온라인 저지

실행법

API 서버와 Client 서버로 구분된 구조이다. 두 서버를 모두 실행하려면 npm start

npm start

API 서버 실행

프로젝트 루트 디렉토리에서 터미널에 node ./servers/app.js

node ./servers/app.js

개발 시 API 서버 실행

소스코드를 수정한 후 저장하면 자동으로 서버를 재시작 해주는 nodemon을 적용하였다. 실행하려면 npm run dev

npm run dev

개발

브랜치 워크플로

  1. 각자 본인의 브랜치에서 작업 후 newdeal/oj-project main branch에 PR을 연다. 코멘트는 자세히 작성하고, 상대방은 코멘트 읽고 리뷰한 후 main에 merge한다.
  2. PR을 merge했으면 다음 작업 전에 main 브랜치에서 git fetch origingit merge origin/main으로 작업물을 가져오고, 각자의 브랜치에서 git merge main으로 머지한 후 충돌나는 부분이 있는지 확인하고 작업한다.
  3. node_modules가 gitignore에 포함되어 있으므로 2번 작업 후 npm install으로 디펜던시 라이브러리를 설치해준다.
  4. config.js 파일에 해싱 키와 DB url, 비번등을 설정해놓고 gitignore에 등록하였으므로 해당 파일에 수정사항이 생기면 꼭 공유!!

코딩 컨벤션 suggested by keisluv

  1. 변수(인스턴스)명은 camalCase, 함수명은 snake_case
  2. 생각나면 추가하자!!

기능

1. 문제 풀이

Start API

user가 문제 start API에 JSON형태로 POST 요청을 보낸다.JSON 형태에는 user_id와 problem_id가 포함되어 있어야 한다.
데이터검증 후 토큰(problem_id , user_id 더한 값을 해싱) + 문제의 초기상태 ( 문제DB에 저장해 둔 시나리오를 쿼리)를 생성하여 JSON 형태로 response.

OnState API

onState API에 get요청을 보내면 해당 토큰에 해당하는 state를 response.
(채점DB에 있는 토큰key에 맞는 value를 쿼리로 날려서 JSON형태로 가져온다.)

Action API
  1. 전달된 명령에 따라 state 바꿔줌
  2. timestamp++
  3. 바뀐 timestamp에서 해당하는 call을 state에 추가
  4. 만약 call이 전부 비었으면 is_end를 true로 바꿔줌 action API에 post요청을 보내면 문제에 해당하는 컨트롤러가 action을 state에 적용 함.
    (채점DB에 있는 해당 value를 가져와서 변경 후 timestamp++,상태 변경. DB저장) 후 바뀐state를 response.
    action API 컨트롤러 끝단에 timestamp의 값을 확인 후 실패,성공 여부를 확인 후 해당 조건이 성립한다면 채점DB의 state 삭제,
    grade 컨트롤러에 state 전달후 grade 측정 후 채점 결과를 response, 채점번호DB에 user_id,problem_id,grade 등을 저장.

2. 유저 information

3. 채점 현황

4. 구글,깃허브,카카오 계정 인증


Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

yarn test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

yarn build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

yarn eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

yarn build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

ojproject-old's People

Contributors

istiopaxx avatar newdeal123 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.