2.3 KiB
2.3 KiB
id, title, localeTitle, challengeType
| id | title | localeTitle | challengeType |
|---|---|---|---|
| 587d7fb2367417b2b2512bf5 | Get Route Parameter Input from the Client | Obter entrada de parâmetro de rota do cliente | 2 |
Description
req.params .
route_path: '/user/:userId/book/:bookId'Construa um servidor de eco, montado na rota
actual_request_URL: '/user/546/book/6754'
req.params: {userId: '546', bookId: '6754'}
GET /:word/echo . Responda com um objeto JSON, tomando a estrutura {echo: word} . Você pode encontrar a palavra a ser repetida em req.params.word . Você pode testar sua rota a partir da barra de endereços do seu navegador, visitando algumas rotas correspondentes, por exemplo, your-app-rootpath / freecodecamp / echo
Instructions
Tests
tests:
- text: 'Teste 1: seu servidor de eco deve repetir palavras corretamente'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/eChOtEsT/echo'').then(data => { assert.equal(data.echo, ''eChOtEsT'', ''Test 1: the echo server is not working as expected'') }, xhr => { throw new Error(xhr.responseText); })'
- text: 'Teste 2: seu servidor de eco deve repetir palavras corretamente'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/ech0-t3st/echo'').then(data => { assert.equal(data.echo, ''ech0-t3st'', ''Test 2: the echo server is not working as expected'') }, xhr => { throw new Error(xhr.responseText); })'
Challenge Seed
Solution
// solution required