Snippets Collections
{
  "data": {
    "projects": [
      {
        "description": "This was my first major programming project that I ever saw through from start to finish. It's an emulator I wrote during the sophomore year of my undergrad. This was done so I could have a better understanding of emulation and basic hardware principles. Looking back now, it really lacks some understanding of useful C++ features and proper formatting, as well as typical C++ programming style. Regardless, I found it to be a very informative project that I learned quite a lot from.",
        "title": "SDL-CHIP8",
        "url": "https://gitlab.stegall.me/swstegall/SDL-CHIP8"
      },
      {
        "description": "Notflix was an application that I made for a class in my Master's to demonstrate my ability to create an application to consume an API using ASP.NET MVC. What it does is utilize a movie database API to give random movie suggestions over different genres. I thought my result at the end looked quite nice, given some of the constraints I dealt with in the original assignment.",
        "title": "Notflix",
        "url": "https://gitlab.stegall.me/swstegall/Notflix"
      },
      {
        "description": "This was an application I made for EarthX Hack 2020. It was inspired by the toilet paper shortage caused by the coronavirus pandemic of 2020. The idea for this app is to list goods that you have, that you wish to trade for other goods. It would allow people to accept a trade offer and a meeting location to exchange items, and cut down on over-consumption in the face of scarcity.",
        "title": "Green Trade",
        "url": "https://gitlab.stegall.me/swstegall/green-trade"
      },
      {
        "description": "Orpheus was my first attempt writing a GUI application with conventional tooling for Windows. It is a relatively lightweight C# music player application that manages its library based on a JSON file. I think the application works decently for the short amount of time I had to learn .NET beforehand, but that the theming component of the application, as well as some more advanced functionality, could be further enhanced. Perhaps I'll tackle a similar type of project in the future once Microsoft finishes their rollout of .NET MAUI.",
        "title": "Orpheus",
        "url": "https://gitlab.stegall.me/swstegall/Orpheus"
      },
      {
        "description": "This was a project I did for TAMUhack 2021 at the beginning of the year. This was my first attempt at a mobile app, and it used React Native, React Native Elements, and JavaScript for the frontend, and Node/Express/Sequelize/TypeScript on the backend, with a database managed with Docker. This was an interesting app, because it made use of barcode scanning to manage some gamification elements.",
        "title": "GOTcha",
        "url": "https://gitlab.stegall.me/swstegall/GOTcha"
      },
      {
        "description": "This project is a chat application that I made to allow for privately-hosted servers. It uses Material UI/React/Redux/TypeScript on the frontend, and Node/Express/Sequelize/TypeScript on the backend with a PostgreSQL database managed with Docker.",
        "title": "Trueno",
        "url": "https://gitlab.stegall.me/swstegall/trueno"
      },
      {
        "description": "This was a hackathon project I did with some friends for Hack-O-Lantern 2021. It's a Course Management Website that supports class creation, registration, and (some) file submission. It was a lot of fun to work on and shows some promise!",
        "title": "Class++",
        "url": "https://gitlab.stegall.me/swstegall/class-plus-plus"
      }
    ]
  }
}
query GetProjectData {
  projects {
    description
    title
    url
  }
}
{
  "data": {
    "projects": [
      {
        "title": "SDL-CHIP8"
      },
      {
        "title": "Notflix"
      },
      {
        "title": "Green Trade"
      },
      {
        "title": "Orpheus"
      },
      {
        "title": "GOTcha"
      },
      {
        "title": "Trueno"
      },
      {
        "title": "Class++"
      }
    ]
  }
}
query GetProjectTitles {
  projects {
    title
  }
}
import graphql.kickstart.tools.GraphQLQueryResolver
import me.stegall.personalwebsiteapi3.models.Project
import me.stegall.personalwebsiteapi3.repositories.ProjectRepository
import org.springframework.data.mongodb.core.MongoOperations
import org.springframework.stereotype.Component

@Component
class ProjectQueryResolver(
  val projectRepository: ProjectRepository,
  private val mongoOperations: MongoOperations
) : GraphQLQueryResolver {
  fun projects(): List<Project> {
    return projectRepository.findAll()
  }
}
schema {
  query: Query
}

type Query {
  projects: [Project]
}

type Project {
  id: ID!
  description: String!
  title: String!
  url: String!
}
const express = require('express')
const { graphqlHTTP } = require("express-graphql");
const {
  GraphQLSchema,
  GraphQLObjectType,
  GraphQLString,
  GraphQLList,
  GraphQLInt,
  GraphQLNonNull
} = require('graphql')
const app = express()
const port = 3000

// Sample Data
const authors = [
	{ id: 1, name: 'Dan Brown' },
	{ id: 2, name: 'J. R. R. Tolkien' },
	{ id: 3, name: 'Brent Weeks' }
]

const books = [
	{ id: 1, name: 'The Lost Symbol', authorId: 1 },
	{ id: 2, name: 'Angels and Demons', authorId: 1 },
	{ id: 3, name: 'The Davinci Code', authorId: 1 },
	{ id: 4, name: 'The Fellowship of the Ring', authorId: 2 },
	{ id: 5, name: 'The Two Towers', authorId: 2 },
	{ id: 6, name: 'The Return of the King', authorId: 2 },
	{ id: 7, name: 'The Way of Shadows', authorId: 3 },
	{ id: 8, name: 'Beyond the Shadows', authorId: 3 }
]

const BookType = new GraphQLObjectType({
  name: 'Book',
  description: 'This represents a book written by an author',
  fields: () => ({
    id: { type: GraphQLNonNull(GraphQLInt) },
    name: { type: GraphQLNonNull(GraphQLString) },
    authorId: { type: GraphQLNonNull(GraphQLInt) },
    author: {
      type: AuthorType, // AuthorType is defined below the same way that BookType is defined above
      resolve: (book) => {
        return authors.find(author => author.id === book.authorId)
      }
    }
  })
})

const AuthorType = new GraphQLObjectType({
  name: 'Author',
  description: 'This represents the author of a book',
  fields: () => ({
    id: { type: GraphQLNonNull(GraphQLInt) },
    name: { type: GraphQLNonNull(GraphQLString) }
  })
})

const RootQueryType = new GraphQLObjectType({
  name: 'Query',
  description: 'Root Query',
  fields: () => ({
    books: {
      type: new GraphQLList(BookType),
      description: "List of books",
      resolve: () => books
    }
  })
})

const schema = new GraphQLSchema({
  query: RootQueryType
})



app.use('/graphql', graphqlHTTP({
  schema: schema,
  graphiql: true
}))


app.get('/', (req, res) => {
  res.send(`<a href="http://localhost:${port}/graphql">GraphiQL</a>`)
})

// QUERY:
// 
// {
// 	books {
//     id
//   	name
//     author {
//       name
//     }
// 	}
// }

// RESULT
// 
// {
//   "data": {
//     "books": [
//       {
//         "id": 1,
//         "name": "The Lost Symbol",
//         "author": {
//           "name": "Dan Brown"
//         }
//       },
//       {
//         "id": 2,
//         "name": "Angels and Demons",
//         "author": {
//           "name": "Dan Brown"
//         }
//       }, //...
//     ]
//   }
// }

app.listen(port, () => {
  console.log(`App listening on http://localhost:${port}`)
});
type Project {
  name: String
  tagline: String
  contributors: [User]
}
star

Wed May 03 2023 02:54:56 GMT+0000 (Coordinated Universal Time)

#graphql #json
star

Wed May 03 2023 02:52:38 GMT+0000 (Coordinated Universal Time)

#graphql
star

Wed May 03 2023 02:50:11 GMT+0000 (Coordinated Universal Time)

#graphql #json
star

Wed May 03 2023 02:47:21 GMT+0000 (Coordinated Universal Time)

#graphql
star

Wed May 03 2023 02:33:53 GMT+0000 (Coordinated Universal Time)

#kotlin #mongodb #graphql
star

Tue May 02 2023 01:43:30 GMT+0000 (Coordinated Universal Time)

#graphql #graphqls
star

Fri Oct 09 2020 23:22:52 GMT+0000 (Coordinated Universal Time) https://github.com/716green/graphql-express-setup/blob/main/server.js

#nodejs #javascript #graphql #express
star

Fri Jun 05 2020 15:53:00 GMT+0000 (Coordinated Universal Time) https://graphql.org/

#graphql

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension