Skip to content

sruusk/ou-lunch

Repository files navigation

MongoDB Nuxtjs TailwindCSS Vite Vue.js WebStorm JavaScript Markdown TypeScript Debian Linux Docker GitHub Git Hetzner

This repository contains the NuxtJS frontend and Nitro backend for fetching, updating, and displaying lunch menus from various restaurant APIs on the Oulu University campus. The menus are stored in a MongoDB database and can be accessed via an API endpoint.

Features

  • Fetches lunch menus from multiple restaurant APIs.
  • Periodically updates the menus in the MongoDB database.
  • Provides an API endpoint to retrieve the compiled list of menus.
  • Displays the lunch menus on a NuxtJS frontend.

Environment

Variable Description Default
NUXT_DB_URL MongoDB connection URL mongodb://127.0.0.1:27017
NUXT_DB_NAME MongoDB database name ou-lunch
NUXT_HERO_CORE_URL Url to a hero cloud instance 127.0.0.1:1818
OPENAI_API_KEY OpenAI API key

API

GET /api/menu

Retrieves a list of restaurants with their menus for today and future dates. view in browser

Query Parameters

Parameter Type Required Description
city string No Filter restaurants by city. If provided, campus must also be provided.
campus string No Filter restaurants by campus. If provided, city must also be provided.

Response

Returns a JSON array of restaurant objects. For the detailed type definition, see server/utils/types.ts.

Error Responses

  • 404 Not Found: No restaurants found with the given parameters.
  • 500 Internal Server Error: Failed to get menus.

Frontend

The frontend for this project is built with NuxtJS and is hosted at ouf.fi.

Development

Parts marked with * are only needed if developing the non-normal opening hours feature.

  • Run npm install in the root directory to install the dependencies.
  • *Run npm run start:cloud to start the Ulixee Cloud instance.
  • Run npm run start:db to start the MongoDB database on Docker. You must have Docker installed.
  • Run npm run dev to start the NuxtJS frontend in development mode.
  • *To update the opening hours, visit localhost:3000/_nitro/tasks/updateHours in your browser.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

License

This project is licensed under the MIT Licence. See the LICENCE file for details.

About

Compiled lunch menus from restaurants on the Oulu University campus

Resources

License

Stars

Watchers

Forks