Backend service for UTPJudge project, basically aims to serve the info (statements, constraints, etc) for programming contests through a RESTful API. This API will be used by the judge-frontent.
The second aim for this backend service is to talk with the judge-bot service.
url | method | description | params |
---|---|---|---|
/users | GET | returns all the users | |
/users | POST | creates a new user |
|
/users/:id | PUT | modifies user data |
|
/users/:id | DELETE | remove a user | |
/problems | GET | returns all the problems | |
/problems/:id | GET | returns a specific problem | |
/problems | POST | creates a new problem |
|
/problems/:id/tc | POST | adds one or more test cases to one problem | You can send a pair of (.in, .out) files or you can send a .tar.gz file with several test cases inside. If you decide to send a .tar.gz, take care of the name of files, we will add one test case for each file which the .in and .out match. For example, if the .tar.gz contains the files 'a.in', 'a.out' , 'b1.in', 'b3.out', only the test case (a.in, a.out) will be added. |
/problems/:id | PUT | modifies problem data | |
/problems/:id | DELETE | remove a problem | |
/submissions | GET | returns all the submissions | |
/submissions | POST | creates a new submission |
|
/submissions/pending | GET | returns all the pending submissions | |
/contests | GET | returns all the contests | |
/contests/:id | GET | returns a specific contest | |
/contests | POST | creates a new contests |
|
/contests/:id/add | POST | add one or more problems to a contest with id equals to :id | Object with
|
/contests/:id | PUT | modifies contest data | |
/contests/:id | DELETE | remove a contest |
All the messages are sent through TCP connections and must be parsable to JSON arrays.
Important: All the messages must be ended with the '\0' character.
The first element in the array defines the type of the operation.
The exact message schema is outlined here
['judgement', verdict] : judgement result. An event must be emited with this message.
['ready'] : bot announcing that is ready to judge
['file', path] : file solicitation.
['submission', data] : submission solicitation. Exactly format of 'data' will be defined HERE(TO DO).
['file', file_identifier, buffer] : part of the file 'file_identifier' contained into a NodeJS buffer.
['endfile', file_identifier] : Announce that the file 'file_identifier' was completely sent.
npm install
In order to authenticate users with the github API you need to do some extra work:
npm run test
npm start
The judge-backend can be used with curl, here you have some examples.
We strongly recommend you to use prettyJSON
-
create a new user:
$ curl -H "Content-Type: application/json" -X POST -d '{"name": "Toby"}' localhost:8080/users | prettyjson
You will receive the following:
__v: 0 updatedAt: 2016-01-13T19:25:59.000Z createdAt: 2016-01-13T19:25:59.000Z _id: 5696a4c78acb3a8559df3371 username: email: name: Toby
-
get all the users:
curl localhost:8080/users | prettyjson
-
submmit solution:
curl -X POST -F "[email protected]" localhost:8080/submissions | prettyjson
Contribution to this project is welcome and it is suggested using pull requests in github that will then be reviewed and merged or commented on. A more specific contribution guideline is outlined on the zmq site, we use that guide as reference.
Please feel free to add yourself to the COLLABORATORS file in an alphanumerically sorted way before you raise the pull request.
The project is released under the MPLv2 license.
Please see LICENSE for full details.
Developed by In-silico.