Front end and back end
도입됨
21:11
컴퓨팅 III: 데이터베이스 웹 앱 구축, 리 및 설명하기
컴퓨팅 III는 웹사이트와 데이터를 연결하고 SQL을 사용하여 의사결정을 지원하도록 요구합니다. 우리의 실습 문제는 어떤 교실에 자리가 남아 있는지입니다. 기록들은…
영어 내레이션 · 영어와 중국어 자막 전환 가능
이 수업의 내용
| English | 의미 |
|---|---|
| server/ˈsɜːvə/ | 서버 |
| request/rɪˈkwest/ | 요청 |
| response/rɪˈspɒns/ | 응답 |
| front end/frʌnt end/ | 프론트엔드 |
| back end/bæk end/ | 백엔드 |
| API/ˌeɪ piː ˈaɪ/ | API(응용 프로그램 인터페이스) |
| JSON/ˈdʒeɪsn/ | JSON(데이터交换格式) |
885 million documents behind a changed number, 2019
- In May 2019 the journalist Brian Krebs reported that the US title-insurance company First American had left about 885 million records — bank details, tax documents — reachable online. A customer's link contained a document number; changing the number showed other people's documents, because the server never checked who was asking.
- Every web app sends a request 请求 to a server 服务器 and receives a response 响应. The server must decide what each user may see.
What went wrong at First American in 2019?
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Changing a number showed others' records.
Front end and back end
- The front end 前端 runs in the browser or app: pages, buttons, forms. The back end 后端 runs on the server: business rules, the database, security checks.
- Anything in the front end can be changed by the user, so security checks belong in the back end.
Match each job to front end or back end.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Security belongs on the server.
APIs
- An API 应用程序接口 is an agreed set of requests a program can make: for example
GET /api/courses/42asks for course 42. - The response has a status code — 200 OK, 401 not logged in, 403 not allowed, 404 not found — and usually a body.
Match each status code to its meaning.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Codes tell the front end what happened.
JSON
- Most web APIs send data as JSON 数据交换格式: names and values in braces, such as
{"id": 42, "title": "Databases", "places": 30}. - JSON is plain text, so both front end and back end in any language can read it.

One request, different server and browser states
A valid ID is not permission. Compare a confirmed empty list with a denied request, a failed lookup and a missing response; the interface must preserve these differences.
Which is valid JSON?
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Names and values in braces, names in double quotes.
Worked example: one request, two checks
A student's app sends GET /api/grades/1057.
- Identity: is there a valid login token? No → 401.
- Permission: is student 1057 this user, or is the user their teacher? No → 403.
- Selection: return only the fields needed — module and grade, not the whole student record — as JSON with 200 OK.
A logged-in student asks for another student's grades. Which status code fits?
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Logged in, but not allowed.
Requests take time
- A response can be slow or fail. The front end shows a loading state, then the data or a clear error message.
- Never assume the network always works.
A front end should show a loading state and handle errors.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Networks are slow or fail.
Hiding a button is not security. First American's links "looked" private; anyone could change the number. The server must check permission on every request.
Hiding a button in the front end stops users reaching the data.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
They can send the request directly.
The front end sends requests through an API; the back end checks identity and permission, then returns a response with a status code and JSON data — only what that user may see.
A timetable app requests GET /api/timetable/88. Describe the checks the server should make and what it returns.
Identity, permission, selection.
어떤 문제가 있었나요? 사이트 팀만 이 내용을 볼 수 있습니다.