초등학교 1학년부터 고등학교 3학년까지 수학 문제를 생성하는 REST API입니다. 학년(grade)을 난이도 시드로 사용하여 모든 연산에 대해 적절한 난이도의 문제를 생성합니다.
Base URL
https://studyroom.vercel.appEndpoints
GET
/api/math/generate수학 문제를 생성합니다.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| grade | number | Yes | 학년 (1-12). 1-6: 초등, 7-9: 중등, 10-12: 고등 |
| operation | string | Yes | 연산 종류 (아래 표 참조) |
| level | number | No | 세부 난이도 (1-5, 기본값: 1) |
| count | number | No | 문제 수 (1-50, 기본값: 10) |
Example Request
curl "https://studyroom.vercel.app/api/math/generate?grade=3&operation=addition&level=2&count=5"Example Response
{
"success": true,
"problems": [
{
"question": "234 + 567 = ?",
"answer": 801,
"choices": [801, 799, 803, 798]
},
{
"question": "456 + 123 = ?",
"answer": 579,
"choices": [579, 577, 581, 576]
}
],
"meta": {
"grade": 3,
"operation": "addition",
"level": 2,
"count": 5
}
}GET
/api/math/operations사용 가능한 연산 목록을 반환합니다.
Example Request
curl "https://studyroom.vercel.app/api/math/operations"Example Response
{
"operations": [
"addition", "subtraction", "multiplication", "division",
"comparison", "blank", "sequence", "clock", "fraction",
"decimal", "divisor", "multiple", "average", "ratio", "percent"
]
}Available Operations
| Operation | Name | Grades |
|---|---|---|
| addition | 덧셈 | 1-12 |
| subtraction | 뺄셈 | 1-12 |
| multiplication | 곱셈 | 2-12 |
| division | 나눗셈 | 2-12 |
| comparison | 크기 비교 | 1-12 |
| blank | 빈칸 채우기 | 1-12 |
| sequence | 수열 | 1-12 |
| clock | 시계 | 1-6 |
| fraction | 분수 | 3-12 |
| decimal | 소수 | 4-12 |
| divisor | 약수 | 4-12 |
| multiple | 배수 | 4-12 |
| average | 평균 | 5-12 |
| ratio | 비율 | 5-12 |
| percent | 퍼센트 | 5-12 |
Grade Mapping
1
초1
2
초2
3
초3
4
초4
5
초5
6
초6
7
중1
8
중2
9
중3
10
고1
11
고2
12
고3
CORS
모든 API 엔드포인트는 CORS가 활성화되어 있어 외부 도메인에서도 호출 가능합니다.
Error Handling
{
"success": false,
"error": "Invalid grade. Must be between 1 and 12."
}