Coder Social home page Coder Social logo

sysyali / vanderbilt_catalog-api Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 375 KB

The Vanderbilt Course Catalog API is a GraphQL and search API for accessing and searching the course catalog of Vanderbilt University. It utilizes MongoDB, Vanderbilt API, and MeiliSearch for efficient data storage, retrieval, and searching. The API provides endpoints for fetching courses, filtering by parameters, and performing keyword searches.

TypeScript 100.00%
course-catalog fastify graphql meilisearch merc mercurius mongodb mongoose nodejs typescript

vanderbilt_catalog-api's Introduction

Vanderbilt Catalog API

This repository contains code that provides a GraphQL API and a search API using MeiliSearch. It also creates the Vanderbilt Course Catalog database using MongoDB and the Vanderbilt API. Fastify is used to create the server and Mercurius is used for to create the GraphQL endpoints.

Installation

To install and run this project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/SySyAli/vanderbilt_catalog-api.git
  2. Install the dependencies:

    cd your-repo
    npm install
  3. Set up the environment variables:

    • MONGODB_URI: MongoDB connection URI (default: 'mongodb://localhost:27017')
    • PORT: Server port (default: 3000)
    • MEILISEARCH_HOST: MeiliSearch host URL (e.g., 'http://localhost:7700')
  4. Set up MeiliSearch:

    • Install MeiliSearch following the instructions in the official documentation.
    • Start the MeiliSearch server using the appropriate command for your setup.
  5. Start the server:

    npm start

    The server will start running on http://localhost:3000.

API Endpoints

GraphQL API

The GraphQL API allows you to interact with the course catalog.

GET /graphql?query&operationName&variables
  • query, the GraphQL query.
  • operationName, the operation name to execute contained in the query.
  • variables, a JSON object containing the variables for the query.
  • The operationName and variables field are not need to be used for this repo as there is not need to specify the type of operation and there are no variables need to specify for the query.
  • This information was taken from Mercurius

Course Schema:

    type Course {
        _id: ID!
        code: String!
        name: String!
        department: String!
        departmentAbbreviation: String!
        hours: String!
        description: String!
    }

Query Types:

Below are the available query types:

course(_id: ID!){fields}

Fetches a single course by its ID.

Example request:

GET /graphql?query={course(_id: "123456789"){ _id, code, name, department, departmentAbbreviation, hours, description}}

courses(code: String, name: String, department: String, departmentAbbreviation: String, hours: String, description: String)

Fetches multiple courses based on the provided filters. If a field is not needed, do not send it in the request. No filters will fetch the entire database.

Request to fetch the entire database:

GET /graphql?query={courses(){ _id, code, name, department, departmentAbbreviation, hours, description}}

Example request with a filter:

GET /graphql?query={courses(department: "Chemistry"){ _id, code, name, department, departmentAbbreviation, hours, description}}

Search API

The search API allows you to perform keyword-based searches on the course catalog using MeiliSearch.

/search/:q

Performs a search query on the course catalog.

Example request:

GET /search/cs

This will return courses related to "cs".

Contributing

Contributions to this project are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. Feel free to use and modify the code as per the license terms.

vanderbilt_catalog-api's People

Contributors

sysyali avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.