- バックエンド
POST /api/v1/run
: 与えられたプログラムを実行するPOST /api/v1/grade
: 与えられた問題に対して、与えられたプログラムを実行して、その結果を返す
- フロントエンド
/problems/sample-problem
: サンプルの問題ページ- 問題文を表示
- プログラムを入力するエディタ
- プログラムを実行するボタン
- テストの実行結果を表示
-
バックエンドサーバーを起動する
cd backend cargo run --release
-
フロントエンドサーバーを起動する
cd frontend bun install --frozen-lockfile bun run dev
http://localhost:3000/problems/sample-problem
にアクセスし、問題ページを表示できることを確認してください。
プログラムを実行する:
$ curl --request POST \
--url http://localhost:5000/api/v1/run \
--header 'Content-Type: application/json' \
--data '{
"language": "Python",
"program": {
"code": "print('\''Hello, world'\'')"
},
"input": {
"stdin": ""
}
}'
{
"stdout": "Hello, world\n",
"stderr": ""
}
問題(sample-problem
)を解く:
$ curl --request POST \
--url http://localhost:5000/api/v1/grade \
--header 'Content-Type: application/json' \
--data '{
"problem_id": "sample-problem",
"language": "Python",
"program": {
"code": "print('\''Hello, world!'\'')"
}
}'
{
"problem_id": "sample-problem",
"test_results": [
{
"test_id": "sample-test-1",
"status": "Passed",
"actual": "Hello, world!\n",
"expected": "Hello, world!\n",
"stderr": ""
}
]
}