💻 Backend Engineering — Week 01

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play

1/10

encourage image

There are no tags or description

Looks like no tags are added yet.

11 Terms

1
New cards

[Backend] A server's Java application listens only on 127.0.0.1:8080. Why can curl on the server connect but another LAN computer cannot connect directly?

127.0.0.1 is an IPv4 loopback address. The listener accepts local loopback connections, not requests addressed to the server's LAN IP.

2
New cards

[Backend] A service listens on 0.0.0.0:8080. Does that alone guarantee a LAN computer can connect?

No. It listens on all local IPv4 addresses, but routing, firewall rules and other network restrictions still affect access.

3
New cards

[Backend] Can a service listen on 127.0.0.1:8080 while another listens on 192.168.0.219:8080, assuming both addresses exist and no wildcard binding conflicts?

Yes. The local IP addresses differ, so the two TCP listening endpoints can coexist. PIDs alone do not determine endpoint conflicts.

4
New cards

[Backend] Which Linux command lists listening TCP sockets and displays numeric IP addresses and ports?

ss -ltn. -l selects listening sockets, -t selects TCP, and -n avoids name resolution.

5
New cards

[Backend] A client sends HTTP requests to Nginx, which forwards them to a Java application. What role does Nginx perform?

A reverse proxy: it receives client requests and forwards them to an upstream server, then returns the response.

6
New cards

[Backend] Nginx listens on the LAN at port 80. Java listens only on 127.0.0.1:8080 on the same server. How can LAN clients reach the Java API without exposing port 8080?

Clients connect to Nginx on port 80. Nginx forwards requests internally to 127.0.0.1:8080 and returns the backend response.

7
New cards

[Backend] Direct curl to the Java backend /hello returns 200, but Nginx /api/hello returns 404. What should you investigate first?

Check Nginx location matching, proxy_pass URI handling and both services' logs to determine which server returns the 404 and which path the backend receives.

8
New cards

[Backend] Nginx returns HTTP 502 Bad Gateway when forwarding to Java. What does 502 tell you, and what should you check first?

The gateway failed to obtain a valid upstream response. Check whether Java is running, listening on the configured address and port, and inspect proxy logs.

9
New cards

[Backend] NoteService.createNote(note) must call Storage.save(note) exactly once. How can you unit-test this without using a real file?

Inject a recording Storage test double. Call createNote and verify that save received the expected note exactly once.

10
New cards

[Backend] A service runs as appuser and needs to write one application file owned by root. Why not simply run the service as root?

Root grants far more access than required. Give appuser narrowly scoped write access to that file and retain ordinary service privileges.

11
New cards