Skip to content

Latest commit

 

History

History
111 lines (89 loc) · 3.46 KB

README.md

File metadata and controls

111 lines (89 loc) · 3.46 KB

Things to do

Get things to do on a place. Powered by Google's Things to do and Cloudflare worker. NOTE: This project doesn't use google's API.

Endpoints:

1. Search Places

  • Request:
Method: GET
URL: https://<your-app>.workers.dev/search?query={query}
  • Response:
{
    "message": "Place searched!",
    "query": "kolkata",
    "count": 2,
    "data": [
        {
            "id": "0cvw9",
            "name": "Kolkata",
            "description": "City in India",
            "api_path": "/place/0cvw9"
        },
        {...}
    ],
    "error": {
        "message": "No errors",
        "data": []
    }
}
Method: GET
URL: https://<your-app>.workers.dev/place/{id}

2. Get all things to do of a place

  • Request:
Method: GET
URL: https://<your-app>.workers.dev/place/{id}
  • Response:
{
    "message": "Things to do fetched!",
    "id": "0cvw9",
    "name": "Kolkata",
    "description": "West Bengal capital home to Mother Teresa's tomb, British-colonial architecture & art galleries.",
    "about": "Kolkata (formerly Calcutta) is the capital of India's West Bengal state. Founded as an East India Company trading post, it was India's capital under the British Raj from 1773–1911. Today it’s known for its grand colonial architecture, art galleries and cultural festivals. It’s also home to Mother House, headquarters of the Missionaries of Charity, founded by Mother Teresa, whose tomb is on site.",
    "data": [
        {
            "name": "Victoria Memorial",
            "description": "Grand museum for art & Indian history",
            "images": {
                "default": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRP1roLFmJHrgxQvIiDN3gVqKSbGrWr8eL3aXpa5SxYby0h_ZWN7-8dBVeYdWNytoCYqGnq5NuTFfxFPg"
            },
            "coordinates": {
                "lat": 22.5448082,
                "long": 88.3425578
            },
            "rating": {
                "star": 4.5734096,
                "raters": 54809
            },
            "map": "https://www.google.com/maps/place/22.5448082,88.3425578/@22.5448082,88.3425578,100z"
        },
        {...}
    ],
    "error": {
        "message": "No errors",
        "data": []
    }
}

Deploy :

Deploy to Cloudflare Workers

After deployed do these steps:

  • Open Cloudflare Worker Page
  • Click on KV
  • In Namespace Name section Type a Name & Click on Add, a namespace will created.
  • Now go back to worker main page, here you will see that your created worker listed there, click on that.
  • Click on Settings > Variables
  • In KV Namespace Bindings section click on Add Binding
  • Write CACHE in Variable name & select your recently created Namespace for KV namespace.

Credits

Credits go to Google for organizing the data and Clouflare for providing the worker.

License & Copyright :