Skip to content

marmelendez/travelAPI-

 
 

Repository files navigation

Travel API 🌎✈️

An awesome Travel API with many destinations, categories, users and more to use in your next project!
Explore the docs »

Table of Contents
  1. About The Project
  2. Meet the team
  3. Getting Started
  4. Usage
  5. Resources

About The Project

Travel API is the next great API you can use in your projects! Here you will find many data about destinations, categories, users, types of users and favorites. And of course the endpoints needed to work with this data!

Built with

  • JavaScript
  • Nodejs
  • Express
  • Sequelize
  • GitHub
  • Railway
  • Postgresql

(back to top)

Meet the team

(back to top)

Getting started

Prerequisites

Make sure you have Nodejs and NPM installed in your local device.

Install Nodejs and NPM

Installation

  1. Clone the repo git clone https://github.com/proxyz100/travelAPI
  2. Move to directory cd travelAPI
  3. Install npm packages npm i
  4. Open the folder and create a .env file. Add the data with the .env-example variables.
  5. Run the app npm run dev

Check this tutorial to run the app!

(back to top)

Usage

Models

We have five entities with the following properties and methods

User Type Destination Category Favorite
Properties name, surname, email, password, typeId name name, description, cost, image, categoryId landscape, icon, description destinationId, favoriteId
Methods signUp, logIn, update, delete, get, getById get, create, update, delete get, getById, create, update, delete get, getById, create, update, delete get, create, getByUser, getByDestination, delete

There's only three types of users: Admin (access to all methods), Premium (access to favorites methods) and Basic.

(back to top)

Basic flow

  1. First you have to sign up
{
	"name": "Francisco",
	"surname": "Solis",
	"email": "fransoli@hotmail.com",
	"password": "fransolis",
	"TypeId": 1
}
  1. Then log in with the email and password
{
	"email": "fran4@hotmail.com",
	"password": "fransolis"
}
  1. You'll get a token, with this token you'll have access to the services based on the User Type.
  2. And that's it! Start testing all the methods the user has access to 🥳

⚠️ Considerations

  • You can only have a maximium of 3 Types of user. There's only 1-Admin, 2-Premium, 3-Basic.
  • Before you create a new Destination, you have to create the Category you'll add to it.
  • You need to get a valid token to access some methods, if not you'll get an 401 Unauthorized error

(back to top)

Testing

For more examples, check the Documentation and Insomia Tests.

There's already some users and types in the database you can test with the API. But you can still create new users (with the defined types).

Types

id name
1 Admin
2 Premium
3 Basic

Users

email password typeId
marcon@hotmail.com SVNJn994M$ 1
frasol@hotmail.com 57PEGdR#9@ 2
almlov@hotmail.com xxY*8tq39A 2
marmel@hotmail.com y7z2Vj7%TG 2
serurb@hotmail.com veZq7$82!! 2
petfra@hotmail.com *qQ4!38T2Q 2
hecsif@hotmail.com 3Bs4k!3HEy 2
carsan@hotmail.com kx*T86X2A2 2
margue@hotmail.com nM99K7$e6% 3
jazrey@hotmail.com 92#jSB35p% 3
leogal@hotmail.com !9FFv3y89j 3
luzqui@hotmail.com gRR6$H74Qe 3
sebher@hotmail.com 66%CDRgce6 3
frigut@hotmail.com 4#GJp$84Xx 3

(back to top)

Resources

  • Tracking: Trello
  • Database: models and relations

diagrams

(back to top)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.7%
  • Shell 0.3%