We can use Joi to verify endpoints. By using a Joi object we can specify very customizable validation in path, request payloads, and responses.

Create a server that has a route configuration exposing an endpoint login which can be accessed using a 'POST' method. Specifically:

```
/login
```

login endpoint will accept isGuest (boolean), username (string), accessToken (alphanumeric) and
password (alphanumeric) in post request body. Validation should follow following condition
i)   if ```isGuest``` is false then username is required.
ii)  ```password``` cannot appear together with ```accessToken```.
iii) if any parameters other than specified above are sent then it should allow by validation.

-----------------------------------------------------------------
##HINTS

Create a server that listens on port 8080 with the following code:

```js

var routeConfig = {
    path: '/a/path/',
    method: 'POST',
    handler: myHandler,
    config: {
        validate: {
           payload : Joi.object({
                username: Joi.string(),
                password: Joi.string().alphanum(),
                accessToken: Joi.string().alphanum(),
                birthyear: Joi.number().integer().min(1900).max(2013),
                email: Joi.string().email()
           }).options({allowUnknown: true}).with('username', 'birthyear').without('password', 'accessToken');
        }
    }
}
```

Route information can be found in the Hapi directory
in `node_modules/hapi/docs/Reference.md`.

Joi information can be found in `node_modules/hapi/node_modules/joi/README.md`.

By using a Joi object we can specify highly customizable validation rules in paths, request payloads, and responses.

Create a server exposing a login endpoint and reply with "login successful" when an HTTP POST request is sent to `/login`.

The endpoint will accept following payload variables:

```isGuest```       (boolean)
```username```      (string)
```accessToken```   (alphanumeric)
```password```      (alphanumeric)

Validation should consist of following conditions:

i)   if ```isGuest``` is false, a ```username``` is required.
ii)  ```password``` cannot appear together with ```accessToken```.
iii) if any other parameters than specified above are sent, they should pass the validation.

-----------------------------------------------------------------
##HINTS

Create a server that listens on port 8080 with the following code:

```js

var routeConfig = {
    path: '/a/path/',
    method: 'POST',
    handler: myHandler,
    config: {
        validate: {
           payload : Joi.object({
                username: Joi.string(),
                password: Joi.string().alphanum(),
                accessToken: Joi.string().alphanum(),
                birthyear: Joi.number().integer().min(1900).max(2013),
                email: Joi.string().email()
           }).options({allowUnknown: true}).with('username', 'birthyear').without('password', 'accessToken');
        }
    }
}
```

Route information can be found in the Hapi directory
in `node_modules/hapi/docs/Reference.md`.

Joi information can be found in `node_modules/hapi/node_modules/joi/README.md`.

Clarify exercise description and fix spelling errors.
Clarify exercise description and fix spelling errors.
