This is a RESTful API for managing travel-related information, including cities, tourist places, and user authentication. It is built with NestJS and TypeScript.
- Create a city
- Get a list of all cities
- Search for cities
- Delete a city
- Edit a city
- Add tourist places for a city
- Delete a tourist place
- Edit a tourist place
- User registration
- User login
- Authenticated routes
- Node.js (version X.X.X)
- npm (version X.X.X)
- PostgreSQL (version X.X.X)
Clone the repository:
git clone https://github.com/BaseMax/TravelAPITS.git
Install the dependencies:
cd TravelAPITS
npm install
Configure the database:
- Create a PostgreSQL database.
- Update the database configuration in
src/config/database.ts
.
Run database migrations:
npm run migration:run
Start the server:
npm run start:dev
The API server will start running at http://localhost:3000.
POST /cities
- Create a cityGET /cities
- Get a list of all citiesGET /cities/search?q={query}
- Search for cities (replace {query} with the search term)GET /cities/{id}
- Get details of a specific cityPUT /cities/{id}
- Update a specific cityDELETE /cities/{id}
- Delete a specific city
POST /cities/{cityId}/tourist-places
- Add a tourist place for a cityGET /cities/{cityId}/tourist-places
- Get tourist places for a cityGET /cities/{cityId}/tourist-places/{id}
- Get details of a specific tourist placePUT /cities/{cityId}/tourist-places/{id}
- Update a specific tourist placeDELETE /cities/{cityId}/tourist-places/{id}
- Delete a specific tourist place
POST /auth/register
- User registrationPOST /auth/login
- User loginGET /auth/check
- Check authentication status
Make sure to set the following environment variables:
PORT
- The port on which the server will run (default: 3000)DATABASE_HOST
- PostgreSQL database hostDATABASE_PORT
- PostgreSQL database portDATABASE_USERNAME
- PostgreSQL database usernameDATABASE_PASSWORD
- PostgreSQL database passwordDATABASE_NAME
- PostgreSQL database nameJWT_SECRET
- Secret key for JSON Web Token generation
Contributions are welcome! Please feel free to open issues or submit pull requests.
This project is licensed under the GPL-3.0 License.
Copyright 2023, Max Base