Giter Site home page Giter Site logo

basemax / travelapits Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 379 KB

This is a RESTful API for managing travel-related information, including cities, tourist places, and user authentication. It is built with NestJS and TypeScript.

License: GNU General Public License v3.0

JavaScript 2.65% TypeScript 97.35%
javascript js ts typescript api api-restful api-typescript nestjs nestjs-api restful

travelapits's Introduction

Travel API TS

This is a RESTful API for managing travel-related information, including cities, tourist places, and user authentication. It is built with NestJS and TypeScript.

Features

  • 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

Prerequisites

  • Node.js (version X.X.X)
  • npm (version X.X.X)
  • PostgreSQL (version X.X.X)

Installation

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.

API Endpoints

Cities

  • POST /cities - Create a city
  • GET /cities - Get a list of all cities
  • GET /cities/search?q={query} - Search for cities (replace {query} with the search term)
  • GET /cities/{id} - Get details of a specific city
  • PUT /cities/{id} - Update a specific city
  • DELETE /cities/{id} - Delete a specific city

Tourist Places

  • POST /cities/{cityId}/tourist-places - Add a tourist place for a city
  • GET /cities/{cityId}/tourist-places - Get tourist places for a city
  • GET /cities/{cityId}/tourist-places/{id} - Get details of a specific tourist place
  • PUT /cities/{cityId}/tourist-places/{id} - Update a specific tourist place
  • DELETE /cities/{cityId}/tourist-places/{id} - Delete a specific tourist place

Authentication

  • POST /auth/register - User registration
  • POST /auth/login - User login
  • GET /auth/check - Check authentication status

Environment Variables

Make sure to set the following environment variables:

  • PORT - The port on which the server will run (default: 3000)
  • DATABASE_HOST - PostgreSQL database host
  • DATABASE_PORT - PostgreSQL database port
  • DATABASE_USERNAME - PostgreSQL database username
  • DATABASE_PASSWORD - PostgreSQL database password
  • DATABASE_NAME - PostgreSQL database name
  • JWT_SECRET - Secret key for JSON Web Token generation

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests.

License

This project is licensed under the GPL-3.0 License.

Copyright 2023, Max Base

travelapits's People

Contributors

alirezanqp avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.