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 request = require('request'); | |
const API_KEY = 'xxx'; | |
const body = { | |
'longDynamicLink': 'https://niralar.page.link/?link=http://niralar.com/building-rest-apis-with-swagger-on-node-js/' | |
} | |
request({ | |
url: `https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=${API_KEY}`, | |
method: 'POST', json: true, body | |
}, function (error, response) { |
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 request = require('request'); | |
const API_KEY = 'xxx'; | |
const body = { | |
'dynamicLinkInfo': { | |
'domainUriPrefix': 'https://niralar.page.link', | |
'link': 'http://niralar.com/building-rest-apis-with-swagger-on-node-js/' | |
} | |
} | |
request({ |
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 server = require('./server.js'); // Import Server/Application | |
// Start application before running the test case | |
beforeAll((done) => { | |
server.events.on('start', () => { | |
done(); | |
}); | |
}); | |
// Stop application after running the test case |
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 Hapi = require('@hapi/hapi'); | |
const users = [ | |
{ id: 1, name: 'Siva' }, | |
{ id: 2, name: 'Sivasankar' }, | |
{ id: 3, name: 'Niralar' } | |
] | |
const server = Hapi.server({ | |
port: 3000, | |
host: 'localhost' |
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
var array = [ | |
[[1], [2], [3], [4]], | |
[[5], [6], [7], [8]], | |
[[9], [10], [11], [12]], | |
[[13], [14], [15], [16]], | |
[[17], [18], [19], [20]] | |
]; | |
function printAllDgl(array) { | |
var i = 0, j = 0, output = []; |
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
var mongoose = require('mongoose'); | |
var express = require('express'); | |
// Connect to MongoDB Using Mongoose ODM | |
mongoose.connect('mongodb://localhost:27017/integration_test', { useNewUrlParser: true }); | |
// Listen For Mongoose Connection Error | |
mongoose.connection.on("error", function (err) { console.error('Failed to Connect MongoDB'); }); | |
// Listen For Mongoose Disconnection |
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 cluster = require('cluster'); | |
const http = require('http'); | |
const numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
console.log(`Master ${process.pid} is running`); | |
// Fork workers. |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<meta name="description" content="List Posts From WordPress Using REST API With cURL In PHP"> | |
<title>Demo - WordPress REST API</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
</head> |
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
'use strict'; | |
var express = require('express'); | |
var { google } = require('googleapis'); | |
// API keys, Client ID and Client Secret @ https://code.google.com/apis/console | |
var GAPI = "AIzaSyBheQiEQ_NYpsFugde-jb8hmC7FBAFEVHI"; | |
var CLIENT_ID = "507857393893-tmnp49jq8of3en7m81dqdidedupris8d.apps.googleusercontent.com"; | |
var CLIENT_SECRET = "aLHvXDEV_I_YpAA4Y9tl1tdg"; | |
var REDIRECT_URL = "http://localhost:3000/oauth2callback"; |
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
var express = require('express'); | |
var mongoose = require('mongoose'); | |
var gridfs = require('gridfs-stream'); | |
var fs = require('fs'); | |
var db_filename = "demo.jpg"; | |
var local_file = "./gridfs.jpg"; | |
mongoose.connect('mongodb://localhost:27017/test', { useNewUrlParser: true }); | |
mongoose.Promise = global.Promise; |
NewerOlder