2.3 KiB
2.3 KiB
id, title, localeTitle, challengeType
id | title | localeTitle | challengeType |
---|---|---|---|
587d7fb2367417b2b2512bf5 | Get Route Parameter Input from the Client | Obtener entrada de parámetros de ruta del cliente | 2 |
Description
req.params
.
route_path: '/user/:userId/book/:bookId'Construya un servidor de eco, montado en la ruta
actual_request_URL: '/user/546/book/6754'
req.params: {userId: '546', bookId: '6754'}
GET /:word/echo
. Responda con un objeto JSON, tomando la estructura {echo: word}
. Puede encontrar la palabra que debe repetirse en req.params.word
. Puede probar su ruta desde la barra de direcciones de su navegador, visitando algunas rutas coincidentes, por ejemplo, su-app-rootpath / freecodecamp / echo
Instructions
Tests
tests:
- text: 'Prueba 1: su servidor de eco debe repetir palabras correctamente'
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: 'Prueba 2: su servidor de eco debe repetir palabras correctamente'
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