- About this App
- Production Sites
- Associated Repos
- Ruby version
- Preloaded seeds
- Install Ruby with Brew
- Install
- Reset Database
- Database
- GraphiQL Endpoints
- GraphQL Endpoints
- Contributors
This application has 1 endpoint that currently allows for 4 different implementations. You can log in and create a session, create a comment, delete a comment, and get all of a specific category's comments. This API feeds into a website called AI AT Ally that helps match assistive technologies to disabilities.
ruby 3.2.2
User.create(name: "Rosa Marcellino", email: "rosa@aol.com", password: "rosaslaw10!")
User.create(name: "Amy Rowley", email: "amy@aol.com", password: "Rowley10!")
User.create(name: "Oliver Brown", email: "brown@aol.com", password: "Brown10!")
- In terminal, in any directory
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 3.2.2
$ rbenv global 3.2.2
- pull respository down
- move into directory
- in terminal
bundle
- in terminal
rails db:{create,migrate,seed}
- in terminal
rails server
defaults to 3001
- in terminal
rails db:{drop,create,migrate,seed}
- in browser
http://localhost:3001/graphiql
request
POST http://localhost:3001/graphql
In query
mutation Session{
sessionCreate(email:"<user's email>", password:"<user's password"){
id
email
}
}
example
mutation Session{
sessionCreate(email:"rosa@aol.com", password:"rosaslaw10!"){
id
email
}
}
sample response
{
"data": {
"sessionCreate": {
"id": "1",
"email": "rosa@aol.com"
}
}
}
request
POST /graphql
query
mutation {
commentCreate(
input: {
title: "this is my title",
link: "link.com",
description: "this is my description",
userComment: "this is my comment",
rating: true,
category: "Blindness",
userId: 1
}
) {
id
title
link
description
userComment
rating
categoryId
userId
}
}
response
{
"data": {
"commentCreate": {
"id": "2",
"title": "this is my title",
"link": "link.com",
"description": "this is my description",
"userComment": "this is my comment",
"rating": true,
"categoryId": 1,
"userId": 1
}
}
}
request
POST "/graphql
query
mutation {
commentDelete(
input: {
id: 2
}
) {
id
title
link
description
userComment
rating
categoryId
userId
}
}
regular response
{
"data": {
"commentDelete": {
"id": "2",
"title": "this is my title",
"link": "link.com",
"description": "this is my description",
"userComment": "this is my comment",
"rating": true,
"categoryId": 1,
"userId": 1
}
}
}
error response (if comment couldn't be deleted, usually because comment id doesn't exist)
{
"data": {
"commentDelete": null
},
"errors": [
{
"message": "Comment not deleted.",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"commentDelete"
]
}
]
}
request
POST /graphql
query
{
allCategoryComments(
categoryId: 1
) {
id
title
link
description
userComment
rating
categoryId
userId
}
}
response
{
"data": {
"allCategoryComments": [
{
"id": "1",
"title": "this is my title",
"link": "link.com",
"description": "this is my description",
"userComment": "this is my comment",
"rating": true,
"categoryId": 1,
"userId": 1
},
{...},
{...}
]
}
}
- Nick Spencer @github.com/deadbert
- Joop Stark @github.com/JoopStart
- Eliza Keating @github.com/elizakeating