Consider the following code snippet
4 phương ánCó giải thíchDễ
using Express.js. Identify which routes handle GET and POST requests. app.get('/users', ...);
app.post('/users', ...);app.listen(3000, ...) (Choose 2 answers)
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Để xác định các đường dẫn xử lý GET và POST yêu cầu, chúng ta cần xem xét các dòng mã sau: app.get('/users', ...); app.post('/users', ...). Trong đó, app.get() được sử dụng để xử lý GET yêu cầu, trong khi app.post() được sử dụng để xử lý POST yêu cầu. Điều này có nghĩa là đường dẫn /users sẽ xử lý cả GET và POST yêu cầu. Vì vậy, hai đáp án đúng là: "The /users endpoint handles GET requests." và "The /users endpoint handles POST requests."
Cùng chương 3
______ is a fast, unopinionated and minimalist web framework for Node.jsCó lời giảiCâu hỏiWhat does the res.send() method do in Express.js?Có lời giảiCâu hỏiAnalyze the following codes: app.get('/', (req, res) => { res.send('Hello, this is a GET request'); }); app.listen(3000, ...). What is right URL to display the text "Hello, this is a GET request"?Có lời giảiCâu hỏiCả 24 câu của chủ đề24 câu