Skip to content

Commit

Permalink
Merge Conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubh-Nisar committed Oct 18, 2023
2 parents a3c451f + bceff2b commit 5525dd0
Show file tree
Hide file tree
Showing 35 changed files with 754 additions and 627 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/Code_Formatter_and_Syntax_Check.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
name: Code Formatter and Syntax Check
on:
pull_request:
branches:
- master
branches: ["master"]
push:
branches:
- master
branches: ["master"]
jobs:
test:
name: Check the source code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install packages
run: |
cd Code/backend
npm install
- name: Lint
run: |
cd Code/backend
npx eslint ./dao
npx eslint ./controllers
8 changes: 4 additions & 4 deletions .github/workflows/Style_Checker_and_Prettify_Code.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Style Checker and Prettify Code
on:
pull_request:
branches: ["master"]
push:
branches:
- master
branches: ["master"]

jobs:
prettier:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Prettify code
uses: creyD/prettier_action@v4.0
uses: creyD/prettier_action@v4.3
with:
prettier_options: --write **/*.{js,md}
8 changes: 3 additions & 5 deletions .github/workflows/codeFormatter.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: Check the source code
on:
pull_request:
branches:
- master
branches: ["master"]
push:
branches:
- master
branches: ["master"]
jobs:
test:
name: Check the source code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install packages
run: |
cd Code/backend
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Running Code Coverage

on: [push, pull_request]
on:
pull_request:
branches: ["master"]
push:
branches: ["master"]

jobs:
build:
Expand All @@ -9,16 +13,16 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [18.x]

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -34,7 +38,7 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

6 changes: 5 additions & 1 deletion .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Greetings

on: [pull_request, issues]
on:
pull_request:
branches: ["master"]
issues:
branches: ["master"]

jobs:
greeting:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
# https://github.com/actions/labeler

name: Labeler
on: [pull_request]
on:
pull_request:
branches: ["master"]

jobs:
label:
Expand Down
46 changes: 26 additions & 20 deletions Code/backend/app.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
const express = require('express');
const dotenv = require('dotenv');
const morgan = require('morgan');
const express = require("express");
const dotenv = require("dotenv");
const morgan = require("morgan");
const app = express();
const colors = require("colors");
const connectDB = require('./config/db.js');
const {notFound, errorHandling} = require('./utils/errorhandling.js')
const connectDB = require("./config/db.js");
const { notFound, errorHandling } = require("./utils/errorhandling.js");

colors.enable();

const cors = require('cors');
const cors = require("cors");
app.use(express.json());

dotenv.config();

connectDB();

app.use(express.urlencoded({extended:true}));
app.use(express.urlencoded({ extended: true }));
app.use(cors({ credentials: true }));
app.use(cors());

if (process.env.NODE_ENV === 'development') {
app.use(morgan('dev'));
if (process.env.NODE_ENV === "development") {
app.use(morgan("dev"));
}

const {signInRouter, signUpRouter, signOutRouter, userProfileRouter } = require('./routes/user.js');
const {getRecipe, getCuisine, postRecipe} = require('./routes/recipe.js')
const parsingRecipeData = require('./utils/parsingRecipeData.js')
const {
signInRouter,
signUpRouter,
signOutRouter,
userProfileRouter,
} = require("./routes/user.js");
const { getRecipe, getCuisine, postRecipe } = require("./routes/recipe.js");
const parsingRecipeData = require("./utils/parsingRecipeData.js");

app.get("/", async(req, res) => {
app.get("/", async (req, res) => {
console.log("Hello");
res.send("Hello");
});
Expand All @@ -37,20 +42,21 @@ app.use("/api/v4/signUp", signUpRouter);
app.use("/api/v4/signOut", signOutRouter);
app.use("/api/v4/userProfile", userProfileRouter);

app.use("/api/v4/recipes", getRecipe)
app.use("/api/v4/recipes/cuisines", getCuisine)
app.use("/api/v4/recipes", getRecipe);
app.use("/api/v4/recipes/cuisines", getCuisine);
app.use("/api/v4/recipes/Addrecipes", parsingRecipeData, postRecipe);

app.use(notFound, errorHandling)
app.use(notFound, errorHandling);
const PORT = process.env.PORT || 5000;

app.listen(
PORT,
console.log(
`Server running in ${process.env.NODE_ENV} mode on port ${PORT}`.yellow.bold
)
`Server running in ${process.env.NODE_ENV} mode on port ${PORT}`.yellow
.bold,
),
);

module.exports = {
app
}
app,
};
6 changes: 3 additions & 3 deletions Code/backend/config/db.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const mongoose = require( 'mongoose');
const colors = require('colors');
const mongoose = require("mongoose");
const colors = require("colors");

const connectDB = async () => {
try {
Expand All @@ -15,4 +15,4 @@ const connectDB = async () => {
}
};

module.exports = connectDB;
module.exports = connectDB;
Loading

0 comments on commit 5525dd0

Please sign in to comment.