Welcome to the backend repository for PackMate, an app designed to help you plan and organize your adventure necessities for every trip. This repository focuses on the backend functionality and utilizes GraphQL, a powerful query language, to efficiently handle data retrieval and manipulation.
-
- Public (non-authenticated) users can access all causes on the platform
- Continous Integration with CircleCI
- Continous Deployment with Heroku
- GraphQL server application
-
- PackMate is fully deployed at https://packmate-fe.vercel.app/
- Backend Repo | Frontend Repo
-
Young Heon Koh Margaret Daly
POST request to https://packmate-be-d3fb267b5fee.herokuapp.com/graphql
Items by Category
categories: "Camping"
, "Hiking"
, "Fishing"
, "Climbing"
, "Kayaking"
, "Mountain Biking"
, "Backpacking"
, "Everything"
Request Body
query{
items(category:"Camping") {
id
name
}
}
Response Body status code 200
{
"data": {
"items": [
{
"id": "1",
"name": "Tent"
},
{
"id": "2",
"name": "Flashlight"
},
{
"id": "3",
"name": "Sleeping bag"
},
...
]
}
}
Create a List
Successful Request Body
mutation{
createList(input:{
name: "My Second List"
tripType: "Hiking"
items: ["Hiking Boots", "Sunscreen"]
}){
list {
id
name
tripType
items {
id
name
}
createdAt
updatedAt
}
errors
}
}
Response Body status code 200
{
"data": {
"createList": {
"list": {
"id": "2",
"name": "My Second List",
"tripType": "Hiking",
"items": [
{
"id": "4",
"name": "Hiking Boots"
},
{
"id": "11",
"name": "Sunscreen"
}
],
"createdAt": "2023-07-10T20:28:34Z",
"updatedAt": "2023-07-10T20:28:34Z"
},
"errors": []
}
}
}
Failure Request Body
mutation{
createList(input:{
name: ""
tripType: "Fishing"
items: ["Fishing pole", "Bait"]
}){
list {
id
name
tripType
items {
id
name
}
createdAt
updatedAt
}
errors
}
}
Response Body status code 400
{
"data": {
"createList": null
},
"errors": [
{
"message": "Name cannot be blank",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createList"
]
}
]
}
To set up the PackMate backend locally or contribute to its development, follow these steps:
-
Clone or Fork the repository:
git clone https://github.com/your-username/PackMate-Backend.git
-
Install dependencies:
bundle install
-
Configure the database: Update the database configuration file (
config/database.yml
) with your local database credentials. -
Run database migrations:
rails db:{drop,create,migrate,seed}
-
Execute the RSpec command to run the tests:
bundle exec rspec
-
Start the server:
rails server
You can now make requests to http://localhost:3000/graphql and interact with the PackMate backend locally.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!