- Ketika kita me-running sebuah Kubernetes, artinya kita me-running sebuah Cluster (Kubernetes Cluster).
- Cluster terdiri dari dua bagian besar, yakni Kubernetes Master dan Kubernetes Worker/Node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require("express"); | |
| const fs = require("fs"); | |
| const app = require("./app"); | |
| const server = express(); | |
| // Load file config.json | |
| const file = fs.readFileSync("./config.json"); | |
| const config = JSON.parse(file); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const request = require("request"); | |
| const getStream = require("get-stream"); | |
| const API_KEY = "your-api-key"; | |
| function authorize(authorization) { | |
| if (authorization !== API_KEY) { | |
| throw new Error("Your API key is invalid or incorrect."); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require("axios"); | |
| async function fetchUsers() { | |
| const { data } = await axios.get("https://api.github.com/users"); | |
| return data; | |
| } | |
| async function fetchEmployees() { | |
| const { data: { data } } = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const companyRepository = require("../repositories/company.repository"); | |
| async function fetchCompanyProfile() { | |
| const users = await companyRepository.fetchUsers(); | |
| const employees = await companyRepository.fetchEmployees(); | |
| const companyUsers = []; | |
| for (let user of users) { | |
| companyUsers.push({ | |
| id: user.id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const companyService = require("../services/company.service"); | |
| async function fetchCompanyProfile(req, res) { | |
| try { | |
| const companyProfile = await companyService.fetchCompanyProfile(); | |
| res.json(companyProfile); | |
| } catch (e) { | |
| errorResponse(e, res); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const expect = require("chai").expect; | |
| const nock = require("nock"); | |
| const companyRepository = require("../src/repositories/company.repository"); | |
| const usersMock = require("./mocks/users"); | |
| describe("test company repository", function () { | |
| after(function() { | |
| nock.restore(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const expect = require("chai").expect; | |
| const { stub } = require("sinon"); | |
| const companyRepository = require("../src/repositories/company.repository"); | |
| const companyService = require("../src/services/company.service"); | |
| const usersMock = require("./mocks/users"); | |
| const employeesMock = require("./mocks/employees"); | |
| describe("test company service", function () { | |
| afterEach(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const expect = require("chai").expect; | |
| const { spy, stub } = require("sinon"); | |
| const companyService = require("../src/services/company.service"); | |
| const companyHandler = require("../src/handlers/company.handler"); | |
| const companyProfileMock = { | |
| companyName: 'Facebook Inc', | |
| companyUsers: [ | |
| { id: 1, name: 'mojombo' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "c-17", | |
| "title": "Campaign and Activity", | |
| "items": [ | |
| { | |
| "id": "47", | |
| "type": "link", | |
| "saved": false, | |
| "text": "Chef Siscaa", |
OlderNewer