wiki.ziemers.de

ziemer's informatik Wiki

Benutzer-Werkzeuge

Webseiten-Werkzeuge


wiki:software:beuthbot:mensa-service

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
wiki:software:beuthbot:mensa-service [13.12.2019 09:44]
Christopher Lehmann
wiki:software:beuthbot:mensa-service [24.01.2020 15:12] (aktuell)
Tolga Karaoglu [Versioning]
Zeile 5: Zeile 5:
 ==== Table of content ==== ==== Table of content ====
  
-- [[wiki:software:beuthbot:mensa-service#mensa-microservice|Mensa Microservice]] + - [[wiki:software:beuthbot:mensa-service#mensa microservice|Mensa Microservice]] 
-  - [Table of content](#table-of-content) + - [[wiki:software:beuthbot:mensa-service#table of content|Table Of Content]] 
-  - [Getting Started](#getting-started) + - [[wiki:software:beuthbot:mensa-service#Getting Started|Getting Started]] 
-    - [Prerequisites](#prerequisites) + - [[wiki:software:beuthbot:mensa-service#prerequisites|Prerequisites]] 
-    - [Cloning](#cloning) + - [[wiki:software:beuthbot:mensa-service#cloning|Cloning]] 
-    - [Installing](#installing) + - [[wiki:software:beuthbot:mensa-service#installing|Installing]] 
-  - [Overview](#overview) + - [[wiki:software:beuthbot:mensa-service#overview|Overview]] 
-    - [Structure](#structure) + - [[wiki:software:beuthbot:mensa-service#structure|Structure]] 
-    - [Functionalities](#functionalities) + - [[wiki:software:beuthbot:mensa-service#Functionalities|Functionalities]] 
-      - [The scripts-folder](#the-scripts-folder+ - [[wiki:software:beuthbot:mensa-service#the services-folder|The Services-Folder]
-      - [The services-folder](#the-services-folder) + - [[wiki:software:beuthbot:mensa-service#generateResponse.js|generateResponse.js]] 
-          - [generateResponse.js](#generateresponsejs) + - [[wiki:software:beuthbot:mensa-service#mealService.js|mealService.js]] 
-          - [mealService.js](#mealservicejs) + - [[wiki:software:beuthbot:mensa-service#mealsOfSpecificDayService.js|mealsOfSpecificDayService.js]] 
-          - [mealsOfSpecificDayService.js](#mealsofspecificdayservicejs) + - [[wiki:software:beuthbot:mensa-service#the routes-folder|The Routes-Folder]] 
-      - [The routes-folder](#the-routes-folder) + - [[wiki:software:beuthbot:mensa-service#further development|Further Development]] 
-  - [Further Development](#further-development) + - [[wiki:software:beuthbot:mensa-service#further reading|Further Reading]] 
-  - [Further Reading](#further-reading) + - [[wiki:software:beuthbot:mensa-service#built with|Built With]] 
-  - [Built With](#built-with) + - [[wiki:software:beuthbot:mensa-service#versioning|Versioning]] 
-  - [Versioning](#versioning) + - [[wiki:software:beuthbot:mensa-service#authors|Authors]]
-  - [Authors](#authors)+
  
-## Getting Started+==== Getting Started ====
  
-### Prerequisites+=== Prerequisites ===
  
-- [node.js](https://nodejs.org/en/+- [[https://nodejs.org/en/|node.js]]\\ 
-- [express.js](https://expressjs.com/)+- [[https://expressjs.com/|express.js]]
  
-### Cloning+=== Cloning ===
  
-Get the source code by cloning its repository via https: [mensa_microservice] (https://github.com/Onkilchen/mensa_microservice.git)+Get the source code by cloning its repository via https: [[https://github.com/Onkilchen/mensa_microservice|mensa_microservice]]
  
 +=== Installing ===
  
-### Installing +After cloning the repository, you will need to make sure that you have node and npm installed on your working system. To check if you already have node installed, try\\ 
- +\\ 
-After cloning the repository, you will need to make sure that you have node and npm installed on your working system. To check if you already have node installed, try +''node --version''\\ 
- +\\ 
-`node --version` +Same for checking if npm is installed, just with npm instead of the node command\\ 
- +\\ 
-Same for checking if npm is installed, just with npm instead of the node command +''npm --version''
- +
-`npm --version+
- +
-If you don't have node or npm installed, download the Softare via the links provided in [Prerequisites](#prerequisites) or search for them via your preferred search engine. +
- +
-After that install all necessesary dependencies +
- +
-`npm install` +
- +
-Now you can start the local development server to play around with the API and make your calls +
- +
-`npm run dev` +
- +
-This will fire up a development server that listens on port 8000.+
  
 +If you don't have node or npm installed, download the software via the links provided in [[wiki:software:beuthbot:mensa-service#prerequisites|Prerequisites]] or search for them via your preferred search engine([[https://duckduckgo.com|DuckDuckGo]]).\\
 +\\
 +After that install all necessesary dependencies in the directory where the package.json exists\\
 +\\
 +''npm install''\\
 +\\
 +Now you can start the local development server to play around with the API and make your calls\\
 +\\
 +''npm run dev''\\
 +\\
 +This will fire up a development server that listens on port 8000.\\
 +\\
 If you direct your browser to http://localhost:8000/meals, you will get a list of the meal plan of the actual day for the mensa at the Beuth University for Applied Sciences. If you direct your browser to http://localhost:8000/meals, you will get a list of the meal plan of the actual day for the mensa at the Beuth University for Applied Sciences.
  
-## Overview+==== Overview ====
  
-The mensa microservice is basically a _Node_-_Express_-Backend. Incoming requests are checked and specifically handled.+The mensa microservice is basically a //Node//-//Express//-Backend. Incoming requests are checked and specifically handled.
  
-### Structure+==== Structure ====
  
-The microservice consists of four folders containing several scripts, which are designated to perform certain tasks. We have the *scripts*-folder containing scripts, that will be called by cron-jobs mainly for caching purposes. Then we have the *services*-folder containing files, that consist of functions useful to process incoming requests from the chatbot and to generate a formatted answer-string, that contains the requested meal-menu of a specific day from the Beuth mensa. The *routes*-folder consists of all the routes, that can be addressed. In the next chapters we will get into more details about the scripts and their functions.+The microservice consists of four folders containing several scripts, which are designated to perform certain tasks. Then we have the **services**-folder containing files, that consist of functions useful to process incoming requests from the chatbot and to generate a formatted answer-string, that contains the requested meal-menu of a specific day from the Beuth mensa. The **routes**-folder consists of all the routes, that can be addressed. In the next chapters we will get into more details about the scripts and their functions.
  
-### Functionalities+==== Functionalities ====
  
-On request, this microservice makes calls to the [OpenMensa API](https://doc.openmensa.org/api/v2/). The received data is processed by services that give a list of filtered and unfiltered meals of the mensa of the Beuth University for Applied Sciences. Mainly this service was built throughout the Masterprojekt module that is a mandatory part of the media informatics master course of the Beuth University for Applied Sciences.+On request, this microservice makes calls to the [[https://doc.openmensa.org/api/v2/|OpenMensa API]]. The received data is processed by services that give a list of filtered and unfiltered meals of the mensa of the Beuth University for Applied Sciences. Mainly this service was built throughout the Masterprojekt module that is a mandatory part of the media informatics master course of the Beuth University for Applied Sciences.
  
-#### The scripts-folder+==== Project structure ====
  
-This folder contains two scripts, that will be called by a cron job once a day. Probably early in the morning. `getMealsOfTheDay.js` makes a request to the [OpenMensa API](https://doc.openmensa.org/api/v2/) and caches the answer. After that `writeResponseFile.json` is called and generates a pretty formatted answer-string. Now everytime a User wants to know the meals for the day, we can just read it out of the cached data. +=== The services-folder ===
- +
-#### The services-folder+
  
 This folder consists of several services, that perform specific tasks for the microservice. This folder consists of several services, that perform specific tasks for the microservice.
  
-###### generateResponse.js+== generateResponse.js ==
  
 Creates a nicely formatted string from a mensa-JSON-object and caches it. Creates a nicely formatted string from a mensa-JSON-object and caches it.
  
-###### mealService.js+== mealsOfSpecificDay.js ==
  
-Makes a request to the OpenMensa-API and caches the response. It can also filter the file for specific meals. For example only vegetarian or vegan meals, etc.+Makes a request to the OpenMensa API and filters by given entities (for instance vegan and vegetarian meals only).
  
-###### mealsOfSpecificDayService.js +=== The routes-folder ===
- +
-If a day other than the current day is requested, we need to make another request to the OpenMensa-API, fetch the meals for that specific day, cache them and maybe need to filter them. This is all done by this script. +
- +
-#### The routes-folder+
  
 This folder contains all the routes, that can be addressed on this server. The `index.js` manages all the routes. We've only got two routes in our project. The `/swagger`-route leads you to the swagger documentation of this project.  This folder contains all the routes, that can be addressed on this server. The `index.js` manages all the routes. We've only got two routes in our project. The `/swagger`-route leads you to the swagger documentation of this project. 
Zeile 100: Zeile 92:
 The `/meals`-route will be called by another component of the Beuthbot via `POST`. It expects a message JSON-object containing the requested date for the meals and the filters - to request only specific meals. It then calls all the functions needed to perform requests and generates an answer, which is finally send back as a response to the Chatbot. The `/meals`-route will be called by another component of the Beuthbot via `POST`. It expects a message JSON-object containing the requested date for the meals and the filters - to request only specific meals. It then calls all the functions needed to perform requests and generates an answer, which is finally send back as a response to the Chatbot.
  
-## Further Development+==== Further Development ====
  
 This is still a work in progress, so functionalities and structure might still change during development This is still a work in progress, so functionalities and structure might still change during development
  
-## Further Reading +==== Further Reading ====
- +
-- [OpenMensa API](https://doc.openmensa.org/api/v2/+
- +
-## Built With+
  
-- [Node.js](https://nodejs.org/en/+- [[https://doc.openmensa.org/api/v2/|OpenMensa API]]
-- [Express.js](https://expressjs.com/+
-- [Axios](https://www.npmjs.com/package/axios)+
  
-## Versioning+==== Built With ====
  
-We use [SemVer](http://semver.org/) for versioningFor the versions available, see the [tags on this repository](https://github.com/<you>/<your-repo>/tags).+[[https://nodejs.org/en/|Node.js]]\\ 
 +- [[https://expressjs.com/|Express.js]]\\ 
 +[[https://www.npmjs.com/package/axios|Axios]]
  
-## Authors+==== Versioning ====
  
-- **Tolga Karaoglu** +We use [[http://semver.org/|SemVer]] for versioning. For the versions available, see the [[https://github.com/Onkilchen/mensa_microservice/tags|tags]] on this repository.
-- **Steven Sobkowski**+
  
-See also the list of [contributors](https://github.com/<you>/<your-repo>/contributors) who participated in this project.+==== Authors ====
  
 +- **Tolga Karaoglu**\\
 +- **Steven Sobkowski**\\
 +\\
 +See also the list of [[https://github.com/Onkilchen/mensa_microservice/contributors) who participated in this project|contributors]].
 +<WRAP pagebreak></WRAP>
wiki/software/beuthbot/mensa-service.1576226697.txt.gz · Zuletzt geändert: 13.12.2019 09:44 von Christopher Lehmann