Refactor: Oddělení konektoru na parser menu

This commit is contained in:
2023-06-03 09:36:08 +02:00
parent c814624dbc
commit 19805713cd
3 changed files with 17 additions and 13 deletions

View File

@@ -1,11 +1,12 @@
import express from "express";
import { Server } from "socket.io";
import bodyParser from "body-parser";
import { fetchFood, fetchPizzy } from "./chefie";
import { fetchPizzy } from "./chefie";
import cors from 'cors';
import { getData, updateChoice } from "./service";
import dotenv from 'dotenv';
import path from 'path';
import { fetchMenus } from "./restaurants";
const ENVIRONMENT = process.env.NODE_ENV || 'production'
dotenv.config({ path: path.resolve(__dirname, `../.env.${ENVIRONMENT}`) });
@@ -33,7 +34,7 @@ app.get("/api/data", (req, res) => {
/** Vrátí obědové menu pro dostupné podniky. */
app.get("/api/food", (req, res) => {
fetchFood().then(food => {
fetchMenus().then(food => {
res.status(200).json(food);
})
});