2021-06-15 00:49:18 -07:00
---
id: bd7158d8c443edefaeb5bdff
2021-07-09 21:23:54 -07:00
title: Microservizio Parser di header della richiesta
2021-06-15 00:49:18 -07:00
challengeType: 4
forumTopicId: 301507
dashedName: request-header-parser-microservice
---
# --description--
2021-07-09 21:23:54 -07:00
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:
2021-06-15 00:49:18 -07:00
2021-07-09 21:23:54 -07:00
- Clonare [questa repository GitHub ](https://github.com/freeCodeCamp/boilerplate-project-headerparser/ ) e completare il tuo progetto localmente.
2021-07-19 16:05:37 +05:30
- Usare [la nostra bozza di progetto su Replit ](https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser ) per completare il tuo progetto.
2021-08-25 09:12:11 -07:00
- Usare un costruttore di siti di tua scelta per completare il progetto. Assicurati di incorporare tutti i file del nostro repository GitHub.
2021-06-15 00:49:18 -07:00
2021-08-25 09:12:11 -07:00
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` .
2021-06-15 00:49:18 -07:00
# --hints--
2021-07-09 21:23:54 -07:00
È necessario fornire il proprio progetto, non l'URL di esempio.
2021-06-15 00:49:18 -07:00
```js
(getUserInput) => {
assert(
!/.*\/request-header-parser-microservice\.freecodecamp\.rocks/.test(
getUserInput('url')
)
);
};
```
2021-07-09 21:23:54 -07:00
Una richiesta a `/api/whoami` dovrebbe restituire un oggetto JSON con il tuo indirizzo IP nella chiave `ipaddress` .
2021-06-15 00:49:18 -07:00
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/whoami').then(
(data) => assert(data.ipaddress & & data.ipaddress.length > 0),
(xhr) => {
throw new Error(xhr.responseText);
}
);
```
2021-07-09 21:23:54 -07:00
Una richiesta a `/api/whoami` dovrebbe restituire un oggetto JSON con la tua lingua preferita nella chiave `language` .
2021-06-15 00:49:18 -07:00
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/whoami').then(
(data) => assert(data.language & & data.language.length > 0),
(xhr) => {
throw new Error(xhr.responseText);
}
);
```
2021-07-09 21:23:54 -07:00
Una richiesta a `/api/whoami` dovrebbe restituire un oggetto JSON con il tuo software nella chiave `software` .
2021-06-15 00:49:18 -07:00
```js
(getUserInput) =>
$.get(getUserInput('url') + '/api/whoami').then(
(data) => assert(data.software & & data.software.length > 0),
(xhr) => {
throw new Error(xhr.responseText);
}
);
```
# --solutions--
```js
/**
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.
*/
```