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 hour 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 (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-07T16:34:49.000Z (about 3 years ago)
- Last Synced: 2025-01-27T11:22:11.087Z (about 1 year 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
      
## 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

### Screenshot: Heroku Homepage

### Screenshot: Heroku Render

## Credits
- BCS Resources
## License
© Leo Wong
Licensed under the [MIT License](./LICENSE).