Files

2.5 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
bd7158d8c443edefaeb5bdff Microservizio Parser di header della richiesta 4 301507 request-header-parser-microservice

--description--

Costruisci un'app JavaScript full-stack che sia funzionalmente simile a questa: https://request-header-parser-microservice.freecodecamp.rocks/. Lavorare su questo progetto ti porterà a scrivere il tuo codice utilizzando uno dei seguenti metodi:

Quando hai finito, assicurati che una demo funzionante del tuo progetto sia ospitata in qualche percorso pubblico. Quindi invia l'URL nel campo Solution Link. Facoltativamente, invia anche un link al codice sorgente del tuo progetto nel campo GitHub Link.

--hints--

È necessario fornire il proprio progetto, non l'URL di esempio.

(getUserInput) => {
  assert(
    !/.*\/request-header-parser-microservice\.freecodecamp\.rocks/.test(
      getUserInput('url')
    )
  );
};

Una richiesta a /api/whoami dovrebbe restituire un oggetto JSON con il tuo indirizzo IP nella chiave ipaddress.

(getUserInput) =>
  $.get(getUserInput('url') + '/api/whoami').then(
    (data) => assert(data.ipaddress && data.ipaddress.length > 0),
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

Una richiesta a /api/whoami dovrebbe restituire un oggetto JSON con la tua lingua preferita nella chiave language.

(getUserInput) =>
  $.get(getUserInput('url') + '/api/whoami').then(
    (data) => assert(data.language && data.language.length > 0),
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

Una richiesta a /api/whoami dovrebbe restituire un oggetto JSON con il tuo software nella chiave software.

(getUserInput) =>
  $.get(getUserInput('url') + '/api/whoami').then(
    (data) => assert(data.software && data.software.length > 0),
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

--solutions--

/**
  Backend challenges don't need solutions, 
  because they would need to be tested against a full working project. 
  Please check our contributing guidelines to learn more.
*/