npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rgb-mensa_api

v2.2.0

Published

A json-wrapper around the inofficial API for different canteens of the university (and university of applied sciences) in Regensburg, germany.

Readme

rgb-mensa_api

npm @latest dependencies Status devDependencies Status GitHub issues GitHub license FOSSA Status

This node application is a json-wrapper around the inofficial API for different canteens of the university (and university of applied sciences) in Regensburg, germany.

The original API is kind of unhandy, as it serves its weekly data in the csv format. To improve the handling for more simple applications, this wrapper allows more routes and serves its data in the json format.

The following canteens are supported:

  • OTH
  • OTH evening / abends
  • University (Sammelgebäude)
  • Prüfening

Table of contents

  1. Build
  2. Run
  3. Usage
    3.1. RESTful API
    3.2. GraphQL
    3.3. gRPC
  4. Development
  5. Acknowledges
  6. License

Build

Clone repository:

$ git clone https://github.com/dotWee/rgb-mensa_api && cd rgb-mensa_api

Install dependencies:

$ npm install

Run

Start the application by executing $ npm run start:

$ npm run start

> [email protected] start /Users/lukas/Git/Projects/Javascript/rgb-mensa_api
> node src/server.js

Updating local cache...
Webserver started on port: 3000
GRPC listening on port: 3001

See http://localhost:3000/api-docs for RESTful API docs
Or http://localhost:3000/graphql about GraphQL usage

Usage

This Node.js application is deployed to herokuapp:

  • https://rgb-mensa-api.herokuapp.com/api-docs

RESTful-API

Checkout the API documentation for informations on how to use the RESTful API.

For example, get todays menu for the university canteen:

GET /mensa/uni/today
[
    {
    "name": "Karotten-Ingwer-Suppe",
    "date": "26.11.2018",
    "day": "monday",
    "category": "Suppe",
    "labels": [
      "V"
    ],
    "ingredients": [
      {
        "key": "3",
        "value": "mit Antioxidationsmittel"
      },
      {
        "key": "A",
        "value": "Gluten"
      },
      {
        "key": "AA",
        "value": "Weizen"
      },
      {
        "key": "I",
        "value": "Sellerie"
      }
    ],
    "price": {
      "students": "0,70",
      "employees": "0,90",
      "guests": "1,40"
    }
  }, ...
]

GraphQL

Beside the usual RESTful API, this application also provides a GraphQL service. From GraphQL's website:

GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data. GraphQL isn't tied to any specific database or storage engine and is instead backed by your existing code and data.

You can play with its service by visiting rgb-mensa-api.herokuapp.com/graphql (or localhost:3000/graphql in case of local execution).

Example GraphQL query
{
  ingredients(key: "5") {
    value
  }
  menu(location: "uni", day: "monday") {
    args {
      location
      day
    }
    count
    items {
      name
      date
      day
      category
      labels
      ingredients {
        key
        value
      }
      price {
        students
        guests
        employees
      }
    }
  }
}
Example response
{
    "data": {
        "ingredients": [{
            "value": "geschwefelt"
        }],
        "menu": {
            "args": {
                "location": "uni",
                "day": "monday"
            },
            "count": 1,
            "items": [{
                "name": "Karotten-Ingwer-Suppe",
                "date": "26.11.2018",
                "day": "monday",
                "category": "Suppe",
                "labels": [
                    "V"
                ],
                "ingredients": [{
                        "key": "3",
                        "value": "mit Antioxidationsmittel"
                    },
                    {
                        "key": "A",
                        "value": "Gluten"
                    },
                    {
                        "key": "AA",
                        "value": "Weizen"
                    },
                    {
                        "key": "I",
                        "value": "Sellerie"
                    }
                ],
                "price": {
                    "students": "0,70",
                    "guests": "1,40",
                    "employees": "0,90"
                }
            }]
        }
    }
}

gRPC

This application also supports access using the gRPC Framework with Google's Protocol Buffers as JSON alternative.

This is what the protocol configuration looks like (File src/mensa.proto):

syntax = "proto3";

package rgbmensaapi;

// The ingredients service definition.
service Ingredients {
  // Returns ingredients
  rpc GetIngredients (IngredientsRequest) returns (IngredientsResponse) {}
}

// The ingredients request, may containing a key
message IngredientsRequest {
    string key = 1;
}

// The ingredients response
message IngredientsResponse {
  message Arguments {
    string key = 1;
  }
  Arguments args = 1;
  repeated Ingredient ingredients = 2;
}

// The ingredients object
message Ingredient {
  string key = 1;
  string value = 2;
}

// The menu service definition.
service Menus {
  // Returns menu
  rpc GetMenus (MenuRequest) returns (MenuResponse) {}
}

// The menu request, may containing arguments
message MenuRequest {
  string location = 1;
  string day = 2;
}

// The menu response
message MenuResponse {
  Menu menu = 2;
}

message Menu {
  message Arguments {
    string location = 1;
    string day = 2;
  }
  Arguments args = 1;

  required int64 count = 2;

  message Item {
    string name = 1;
    string date = 2;
    string day = 3;
    string category = 4;
    repeated string labels = 5;
    repeated Ingredient ingredients = 6;

    message Price {
      string students = 1;
      string employees = 2;
      string guests = 3;
    }
    Price price = 7;
  }
  repeated Item items = 3;
}
Example client (using Node.js)
const grpc = require('grpc');
const protoLoader = require('@grpc/proto-loader');

const PROTO_PATH = __dirname + '/protos/mensa.proto';
const packageDefinition = protoLoader.loadSync(
  PROTO_PATH, {
    keepCase: true,
    longs: String,
    enums: String,
    defaults: true,
    oneofs: true,
  },
);

const protoSchema = grpc.loadPackageDefinition(packageDefinition).rgbmensaapi;

function main() {
  const clientIngredients = new protoSchema.Ingredients('localhost:50051', grpc.credentials.createInsecure());
  clientIngredients.getIngredients({
    key: '1',
  }, (err, response) => {
    console.log('Response:', response);
    if (err) {
      console.error(err);
    }
  });

  const clientMenus = new protoSchema.Menus('localhost:50051', grpc.credentials.createInsecure());
  clientMenus.getMenus({}, (err, response) => {
    console.log('Response:', response);
    if (err) {
      console.error(err);
    }
  });
}

main();

Development

For local development, use $ npm run nodemon to work at the source code. The application will reload on code changes.

Acknowledges

This application is heavily inspired by @alexanderbazo's URMensa-JSON-API project.

License

Copyright (c) 2018 Lukas Wolfsteiner. This project is licensed under the Do What The Fuck You Want To public license:

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

Copyright (C) 2018 Lukas Wolfsteiner <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.