Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leoelicos/wander
Node.js, Express.js, Sequelize, Heroku
https://github.com/leoelicos/wander
bcryptjs dotenv expressjs heroku-deployment mysql2 nodejs sequelizejs
Last synced: about 1 month ago
JSON representation
Node.js, Express.js, Sequelize, Heroku
- Host: GitHub
- URL: https://github.com/leoelicos/wander
- Owner: leoelicos
- License: mit
- Created: 2022-05-17T08:50:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-07T16:34:49.000Z (almost 2 years ago)
- Last Synced: 2024-10-15T05:25:32.240Z (3 months ago)
- Topics: bcryptjs, dotenv, expressjs, heroku-deployment, mysql2, nodejs, sequelizejs
- Language: JavaScript
- Homepage: https://wndr.herokuapp.com/
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wander
![Node.js](https://img.shields.io/badge/16.15.0%20LTS-0?label=Node.js&style=for-the-badge&labelColor=white&color=black) ![Express.js](https://img.shields.io/badge/4.17.1-0?label=Express&style=for-the-badge&labelColor=white&color=black) ![Mysql2](https://img.shields.io/badge/2.2.1-0?label=Mysql2&style=for-the-badge&labelColor=white&color=black) ![Sequelize](https://img.shields.io/badge/6.3.5-0?label=Sequelize&style=for-the-badge&labelColor=white&color=black) ![dotenv](https://img.shields.io/badge/8.2.0-0?label=dotenv&style=for-the-badge&labelColor=white&color=black) ![bcrypt](https://img.shields.io/badge/5.0.0-0?label=bcrypt&style=for-the-badge&labelColor=white&color=black) ![Heroku](https://img.shields.io/badge/7.60.2-0?label=heroku&style=for-the-badge&labelColor=white&color=black)
## Introduction
Wander is an API that uses Node.js, Express.js, MySQL, Sequelize, dotenv, bcrypt, Heroku
The app stores a database of Trip entities, which are incidences of Travellers and Locations. Travellers have many Locations, through Trips, and Locations also have many Travellers, through Trips.
The app uses `express.js` to coordinate the routes, and `mysql2` to handle the database;
I made this app to learn about `sql` including creating, reading, updating and deleting actions via `mysql2`.
Deployed: https://wndr.herokuapp.com/api/trips
## Installation
| Steps | Details |
| --------------------------------- | ------------------------------------------------------------------------------- |
| Install `Node.js ` | https://nodejs.org/en/ |
| Install `Mysql` | https://dev.mysql.com/downloads/installer/ |
| Install `Insomnia` | https://insomnia.rest/download |
| Clone this repo | `git clone`
https://github.com/leoelicos/bcs-13-trips-database.git |
| Go inside | ` cd bcs-13-trips-database` |
| Rename `.env.EXAMPLE` | ` mv .env.Example .env` |
| Input mysql credentials in `.env` | ` DB_USER={username}`
`DB_PW={password}`
_Don't forget to save the file!_ |
| Initialize database | `cd db`
`mysql -u root -p`
`{password}`
`source schema.sql;`
`exit` |
| Install dependencies | `cd ..`
`npm install` |
| Run seeds | `npm run seed` |
| Test in Insomnia | See [Usage](#usage) |
| Also test on Heroku | [Trips Database on Heroku](https://leoelicos-trips-database.herokuapp.com/) |## Usage
### Insomnia
| Steps | Details |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Start the server | `npm start` |
| Root endpoint | GET `localhost:3001` |
| Search all travellers | GET `/api/travellers` |
| Find a specific traveller | GET `/api/travellers/:id` |
| Search all locations | GET `/api/locations` |
| Find a specific location | GET `/api/locations/:id` |
| Add a traveller |POST `/api/travellers`
Body: `{`
|
`"name": STRING`
`"email": STRING`
`}`
| Add a location |POST `/api/locations`
Body: `{`
|
`"location_name": INTEGER,`
`}`
| Add a trip |POST `/api/trips`
Body: `{`
|
`"trip_budget": INTEGER,`
`"traveller_amount": INTEGER,`
`"traveller_id": INTEGER,`
`"location_id": INTEGER,`
`}`
| Delete a traveller | DELETE `/api/travellers/:id` |
| Delete a location | DELETE `/api/locations/:id` |
| Delete a trip | DELETE `/api/trips/:id` |## Video Demo
https://user-images.githubusercontent.com/99461390/170417099-e0b73b9b-6b51-44e9-868f-2927e8ff943b.mp4
## Screenshots
### Screenshot: Insomnia GET /api/locations
![Insomnia GET locations](https://user-images.githubusercontent.com/99461390/170417348-6d0a4e0b-e463-4dff-b4f6-d17f0a28426f.jpg)
### Screenshot: Heroku Homepage
![Heroku Homepage](https://user-images.githubusercontent.com/99461390/170417410-e84da0b1-9b1e-4633-aed9-889aae47cbce.jpg)
### Screenshot: Heroku Render
![Heroku Render](https://user-images.githubusercontent.com/99461390/170417462-17359ca0-5eee-42a1-9181-44c35a0249ea.jpg)
## Credits
- BCS Resources
## License
© Leo Wong
Licensed under the [MIT License](./LICENSE).