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
[ | |
{ | |
"operation": "shift", | |
"spec": { | |
"data": { | |
"*": { | |
"id": "data[&1].id", | |
"text": "data[&1].text", | |
"lang": "data[&1].lang", | |
"created_at": "data[&1].tweet_created_at", |
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
class Node { | |
constructor(value) { | |
this.value = value; | |
this.next = null; | |
} | |
} | |
class MyLinkedList { | |
constructor(value) { | |
this.head = { | |
value, |
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 MongoClient = require('mongodb').MongoClient; | |
let mongoDB; | |
const setupDB = callback => { | |
MongoClient.connect( | |
process.env.MONGO_DB_URL, | |
{ useNewUrlParser: true, useUnifiedTopology: true }, | |
(err, _) => { | |
if (err) { | |
return callback(err); |
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
version: "3" | |
services: | |
nodejs-kubernetes: | |
image: local-nodejs-kubernetes | |
environment: | |
PORT: 80 | |
MONGO_DB_URL: mongodb://nodejs-kubernetes-mongodb:27017/nodejs-kubernetes | |
ports: | |
- 8099:80 | |
depends_on: |
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 node:10.16.3-alpine | |
LABEL authors="Yash sharma <yashsharma205@gmail.com>" | |
RUN mkdir /app | |
WORKDIR /app | |
COPY ["./package.json", "yarn.lock", "./"] | |
RUN yarn install |
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 express = require('express'); | |
const app = express(); | |
const port = process.env.PORT; | |
const { setupDB } = require('./db'); | |
setupDB((err, success) => { | |
if(err) throw err; | |
console.log(success) | |
const func = (req, res) => { | |
res.json('Success!') |
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
useEffect(() => { | |
const events = new EventSource('http://192.168.1.73:8099/sse'); | |
events.onmessage = (event) => { | |
console.log(event.data); | |
}; | |
}, []); |
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 proxy = require('http-proxy-middleware') | |
const devURL = 'https://dev.example.com/' | |
const uatURL = 'https://uat.example.com/' | |
const localUrl = 'http://localhost:8099/' | |
const serverURL = localUrl | |
const envUrls = { | |
'/abc': `${serverURL}/abc`, |
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
function humnizedToDate(date){ | |
var validFormats = ['second','seconds','minute','minutes','hour','hours','day','days','week','weeks','month','months','year','years']; | |
var _splitDate = date.split(' '); | |
var findIndex = -1; | |
_splitDate.forEach(function(val){ | |
if( validFormats.indexOf(val) > -1 ) { | |
findIndex = validFormats.indexOf(val); | |
} |
NewerOlder