This file contains 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 path = require("path"); | |
const fs = require("fs"); | |
const os = require("os"); | |
const request = require("request"); | |
const sizeOf = require("image-size"); | |
const resizeImg = require("resize-img"); | |
const uuid = require("uuid/v4"); | |
const repository = require(path.resolve("src/repository")); |
This file contains 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 DataModel = require('./DataModel'); // let's say the target model is 'DataModel', it's based on mongoose. | |
return DataModel.findOne({ "conditionKey": "conditionValue" }) // read data from db | |
.then((data) => { // here update the data | |
data.a = "test"; | |
data.b = 1111; | |
return processData(data); // do some processing with data, let's suppose it returns (processed) data again. | |
}) | |
.then((data) => { | |
return data.save(); |
This file contains 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
from flask import request | |
from flask_socketio import SocketIO | |
# main app | |
from application import app | |
clients = {} | |
socketio = SocketIO(app) | |
## this is the function to notify the user through socket. |
This file contains 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 NodeCache = require('node-cache'); | |
const axios = require('axios'); | |
const { exec } = require('child_process'); | |
const cache = new NodeCache(); | |
const cacheId = 'MONGODB_TIMEDOUT_MONITOR'; | |
const discordWebhook = 'WEBOOK_URL'; | |
const regExp = new RegExp('Server selection timed out after (.*) ms', 'gi'); | |
const activity = { |
This file contains 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
import Axios from './index' | |
const ROUTES = { | |
GET_LESSONS: '/lessons' | |
} | |
export const getLessons = async ({ page = 0 }) => { | |
const response = await Axios.get(ROUTES.GET_LESSONS, { | |
params: { | |
page: page |