Skip to content

Crawler that will look for rooms available for booking within a defined period of check-in and check-out date.

License

Notifications You must be signed in to change notification settings

lucasvalentee/crawler-robot

Repository files navigation

About the project

This project consists of an application node with typing to create a crawler that will search for rooms available for reservation on the website http://lecanton.com.br/ within a defined period of dates for check-in and check-out.

How to start

1 - After cloning the repository to your machine, access the repository folder through a terminal and run the yarn command to install the dependencies.
2 - With the dependencies installed, run the command yarn dev: server to start the server.
3 - You will need a tool to make requests to the Rest API, such as Insomnia or Postman.
4 - The base URL is http://localhost:3333.

How to use the API

The robot will be called on the following POST route: http://localhost:3333/search. When called, it will access a specific path and extract data and information from the available rooms, according to the check-in and check-out informed.


Example of the request body

{
    "checkIn": "13/06/2021",
    "checkOut": "14/06/2021"
}


Example of expected return

[
  {
    "name": "Nome do quarto.",
    "description": "Descrição do quarto.",
    "price": "Valor da diária no formato R$ 0,00",
    "image": [
      "Imagens do quarto"
    ]
  },
]

Handling of expected errors

If the check-in or check-out date is empty or not informed.

{
  "error": "A data de check-in é obrigatória."
}
{
  "error": "A data de check-out é obrigatória."
}


Comparison between check-in and check-out date.

{
  "error": "A data de check-out deve ser igual ou maior que a data de check-in."
}


Comparison of check-in or check-out date with the current date.

{
  "error": "A data de check-in deve ser igual ou maior que a data atual."
}
{
  "error": "A data de check-out deve ser igual ou maior que a data atual."
}


If the API does not find information about available reservations.

{
  "error": "Desculpe-nos. Não existem apartamentos disponíveis para a pesquisa realizada."
}

Author

Lucas Valente

Linkedin Badge

License

NPM

About

Crawler that will look for rooms available for booking within a defined period of check-in and check-out date.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published