Skip to content

Commit

Permalink
resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar Ikechukwu Ekeyekwu committed Sep 3, 2021
2 parents ede4aec + 804e893 commit 9dc5f3e
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 35 deletions.
33 changes: 17 additions & 16 deletions server/src/config/env.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
require('dotenv').config()
const env = process.env.NODE_ENV || 'development'
require("dotenv").config();
const env = process.env ?? process.secrets;
const mode = env.NODE_ENV || "development";

// common environmental variables for all environments
const common = {
PORT: process.env.PORT || 3600,
GIPHY_API_KEY: 'dqp8GYkt1VqBk7GjiuKUYj4QdbJS4phJ',
}
PORT: env.PORT || 3600,
GIPHY_API_KEY: env.GIPHY_API_KEY,
};

// environmental variables for development
const development = {
NODE_ENV: 'development',
DB_URI: 'mongodb://localhost:27017/hobbes',
NODE_ENV: "development",
DB_URI: "mongodb://localhost:27017/hobbes",
...common,
}
};

// environmental variables for production
const production = {
NODE_ENV: 'production',
DB_URI: process.env.DB_URI,
NODE_ENV: "production",
DB_URI: env.DB_URI,
...common,
}
};

// environmental variables for testing
const test = {
NODE_ENV: 'test',
DB_URI: 'mongodb://localhost:27017/hobbes_test',
NODE_ENV: "test",
DB_URI: "mongodb://localhost:27017/hobbes_test",
...common,
}
};

const config = {
development,
production,
test,
}
};

module.exports = config[env]
module.exports = config[mode];
8 changes: 4 additions & 4 deletions server/src/controllers/plugin-info.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const response = require('../utils/response')
const response = require("../utils/response");

class PluginInfoController {
async getInfo(req, res) {
const info = `The company online tools plugin is a feature which allows users to interact with third party tools like Google Drive, Figma, Github, etc. to make work flow for themselves or their team faster and easier.
All our tools are external applications that you may have used or heard of but to maximize productivity, we are giving you access to some of their awesome features right in Zuri Chat.`
All our tools are external applications that you may have used or heard of but to maximize productivity, we are giving you access to some of their awesome features right in Zuri Chat.`;

res.send(response('Plugin Info returned successfully', info))
res.send(response("Plugin Info returned successfully", info));
}
}

module.exports = new PluginInfoController()
module.exports = new PluginInfoController();
16 changes: 16 additions & 0 deletions server/src/controllers/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const response = require("../utils/response");

class SidebarController {
async getSideBarEndpoints(req, res) {
const endpoints = ["/gmail", "github", "figma", "google-drive", "giphy"];

res.send(
response(
"Sidebar endpoints for Online Tools returned successfully",
endpoints
)
);
}
}

module.exports = new SidebarController();
12 changes: 6 additions & 6 deletions server/src/routes/giphy.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const router = require('express').Router()
const giphy = require('../controllers/giphy')
const router = require("express").Router();
const giphy = require("../controllers/giphy");

module.exports = function () {
router.get('/random', giphy.randomGif)
router.get("/giphy/random", giphy.randomGif);

router.get('/trending', giphy.trendingGifs)
router.get("/giphy/trending", giphy.trendingGifs);

return router
}
return router;
};
2 changes: 1 addition & 1 deletion server/src/routes/googledrive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const router = require("express").Router();
const googleDrvieController = require("../../controllers/googledrive/index");

module.exports = function () {
router.get("/", googleDrvieController.index);
router.get("/googledrive", googleDrvieController.index);

return router;
};
24 changes: 16 additions & 8 deletions server/src/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
const router = require('express').Router()
const pluginInfoRouter = require('./plugin-info')
const giphy = require('./giphy')
const router = require("express").Router();
const pluginInfoRouter = require("./plugin-info");
const googleDriveApi = require("./googledrive");
const sideBarRouter = require("./sidebar");
const giphy = require("./giphy");

module.exports = () => {
router.use('/giphy', giphy())
router.use(pluginInfoRouter())
router.use('/googledrive',googleDriveApi());
return router
}
router.use(pluginInfoRouter());
router.use(googleDriveApi());
router.use(sideBarRouter());
router.use(giphy());

// Handle Invalid API routes
router.use((req, res, next) => {
next(new NotFoundError());
});

return router;
};
9 changes: 9 additions & 0 deletions server/src/routes/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const router = require("express").Router();

const sideBarController = require("../controllers/sidebar");

module.exports = function () {
router.get("/sidebar", sideBarController.getSideBarEndpoints);

return router;
};

0 comments on commit 9dc5f3e

Please sign in to comment.