Detailed reference for all endpoints, features, and usage of the Travel Assistant API.
. ├── views/ # EJS views for testing ├── public/ # Static files ├── DomesticTrip.json # Sample preference file (domestic) ├── ForeignTrip.json # Sample preference file (foreign) ├── index.js # Main server file
GET /location-info?city=faridabad&state=apExample Response:
{ "location": { "city": "Faridabad", "state": "Andhra Pradesh", "country": "India", "latitude": 28.41, "longitude": 77.31 }, "weather": { "temperature_2m_max": [...], "temperature_2m_min": [...] }, "facilities": [ {...}, {...}, ... ] }
Route | Method | Description | Sample Usage |
---|---|---|---|
/location-info |
GET | Returns geolocation, weather, and facilities for a city/state. | /location-info?city=delhi&state=delhi |
/preference |
GET | Returns trip preferences (domestic/foreign) from sample JSON files. | /preference/foreign-trips?query |
/user |
GET, POST, PUT, DELETE | User management endpoints. | /user/profile |
/api |
GET | Returns a simple greeting JSON. | /api |
API | Purpose | Free Tier? |
---|---|---|
Open-Meteo | Weather + Geocoding | ✅ Yes |
OpenStreetMap Nominatim | Facility Search | ✅ Yes |
All APIs used are free, no keys required, and suitable for personal or academic use.
Method | Endpoint | Protected? | Description | Body/Headers |
---|---|---|---|---|
POST | /user/register | No | Register a new user |
{ "username": "yourname", "email": "your@email.com", "password": "yourpassword" } |
POST | /user/login | No | Login and receive JWT tokens |
{ "email": "your@email.com", "password": "yourpassword" } |
GET | /user/profile | Yes | Get the authenticated user's profile |
Headers:
Authorization: Bearer <access_token> |
POST | /user/logout | Yes | Logout user (client should delete token) |
Headers:
Authorization: Bearer <access_token> |
POST | /user/refresh-token | No | Get a new access token using a refresh token |
{ "refreshToken": "<refresh_token>" } |
Note: All protected routes require a valid JWT access token in the Authorization
header.