An awesome Travel API with many destinations, categories, users and more to use in your next project!
Explore the docs »
Table of Contents
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!
Make sure you have Nodejs and NPM installed in your local device.
- Clone the repo
git clone https://github.com/proxyz100/travelAPI
- Move to directory
cd travelAPI
- Install npm packages
npm i
- Open the folder and create a .env file. Add the data with the .env-example variables.
- Run the app
npm run dev
Check this tutorial to run the app!
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.
- First you have to sign up
{
"name": "Francisco",
"surname": "Solis",
"email": "fransoli@hotmail.com",
"password": "fransolis",
"TypeId": 1
}
- Then log in with the email and password
{
"email": "fran4@hotmail.com",
"password": "fransolis"
}
- You'll get a token, with this token you'll have access to the services based on the User Type.
- And that's it! Start testing all the methods the user has access to 🥳
- 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
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
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 |
- Tracking: Trello
- Database: models and relations