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
Common Node.js deployment problems | |
Problems occurring in Node.js application deployments can have a range of symptoms, but can generally be categorized into the following: | |
Uncaught exception or error event in JavaScript code | |
Excessive memory usage, which may result in an out-of-memory error | |
Unresponsive application, possibly looping or hanging | |
Poor performance | |
Crash or abort in native code | |
Unexpected application behavior or functional issue |
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 React from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import Car1 from './Car' | |
// function App() { | |
// return ( | |
// <div className="App"> | |
// <h1>Helloworld</h1> | |
// </div> |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: kubernetes-tutorial-deployment | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: kubernetes-tutorial-deployment | |
template: |
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 els = require('event-loop-stats') | |
console.log(els.sense()) | |
const end = Date.now() + 50 | |
setTimeout(() => { | |
console.log(els.sense()) | |
}, 100) |
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 grpc = require('grpc') | |
const PROTO_PATH = './notes.proto' | |
const NoteService = grpc.load(PROTO_PATH).NoteService | |
const client = new NoteService('localhost:50051', | |
grpc.credentials.createInsecure()) | |
console.log('client', client) | |
module.exports = client | |
client.list({}, (error, notes) => { |
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 genericPool = require("generic-pool"); | |
const DbDriver = require("mysql"); | |
/** | |
* Step 1 - Create pool using a factory object | |
*/ | |
const factory = { | |
create: function() { | |
return DbDriver.createConnection({ | |
host: '192.168.8.221', |
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
/** | |
* Three Sum | |
* | |
* Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique | |
* triplets in the array which gives the sum of zero. | |
* | |
* Note: | |
* | |
* The solution set must not contain duplicate triplets. | |
* |
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 cassandra = require('cassandra-driver'); | |
var PlainTextAuthProvider = cassandra.auth.PlainTextAuthProvider; | |
var client = new cassandra.Client({ | |
contactPoints: ["50.112.59.244"], | |
authProvider: new PlainTextAuthProvider('iccassandra', '636fd7882101b8387d4fc43b1ea499ec'), | |
localDataCenter: 'AWS_VPC_US_WEST_2', | |
keyspace: 'keyspace' | |
}); |
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
//Refferd https://medium.com/codingthesmartway-com-blog/creating-a-graphql-server-with-node-js-and-express-f6dddc5320e1 | |
var express = require('express'); | |
var express_graphql = require('express-graphql'); | |
var { buildSchema } = require('graphql'); | |
// GraphQL schema | |
var schema = buildSchema(` | |
type Query { | |
course(id: Int!): Course | |
courses(topic: String): [Course] |
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 Knex = require('knex') | |
var knex = Knex({ | |
client: 'mysql', | |
connection: { | |
host: '192.168.8.221', | |
user: 'user_name', | |
password: 'some_pass', | |
database: 'vehicle' | |
} | |
}); |