Skip to content

Instantly share code, notes, and snippets.

View thoughtspeed7's full-sized avatar

Raj Chaudhary thoughtspeed7

View GitHub Profile
@thoughtspeed7
thoughtspeed7 / package.json
Created August 8, 2021 10:54
Apollo GraphQL Server 3 Using Express On Google App Engine
{
"name": "apollo-server-3-express-gae",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "Raj Chaudhary",
@thoughtspeed7
thoughtspeed7 / data-loader-for-one-to-many-relationships.js
Created September 28, 2020 01:54
DataLoader for One-to-Many Relationships
// om namah shivay
transformOneToMany(keys, rows, column) {
const map = {};
for (let i = 0; i < keys.length; i++) {
map[keys[i]] = [];
}
for (let i = 0; i < rows.length; i++) {
@thoughtspeed7
thoughtspeed7 / index.js
Created June 13, 2018 07:04
Stackdriver Debugger on Google Cloud Functions
// om namah shivay
const debug = require('@google-cloud/debug-agent').start({ allowExpressions: true });
let debugInitialized;
let functionCompleted;
let responseJSON;
const main = (req, res) => {
@thoughtspeed7
thoughtspeed7 / aws-sdk-node-best-practices-optimized.js
Created June 11, 2018 08:36
AWS SDK for Node.js Best Practices
// om namah shivay
// only imports the AWS DynamoDB service client
const dynamodb = require('aws-sdk/clients/dynamodb');
const config = {
region: 'us-east-1',
endpoint: 'https://dynamodb.us-east-1.amazonaws.com'
};
@thoughtspeed7
thoughtspeed7 / aws-sdk-node-best-practices-non-optimized.js
Created June 11, 2018 08:33
AWS SDK for Node.js Best Practices
// om namah shivay
// imports the entire AWS SDK
const aws = require('aws-sdk');
aws.config.update({
region: 'us-east-1',
endpoint: 'https://dynamodb.us-east-1.amazonaws.com'
});
@thoughtspeed7
thoughtspeed7 / node-app.yaml
Created June 6, 2018 08:23
Node, Python and Go in a single Google App Engine project!
# om namah shivay
# See https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
# and https://cloud.google.com/appengine/docs/flexible/nodejs/reference/app-yaml for more info
runtime: nodejs
env: flex
service: default
# The settings below are to reduce costs during testing and not appropriate for production use.
@thoughtspeed7
thoughtspeed7 / package.json
Created June 5, 2018 18:48
Node, Python and Go in a single Google App Engine project!
{
"name": "node",
"version": "1.0.0",
"description": "",
"main": "hello.js",
"scripts": {
"start": "node hello.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Raj Chaudhary",
@thoughtspeed7
thoughtspeed7 / hello.js
Created June 5, 2018 18:46
Node, Python and Go in a single Google App Engine project!
// om namah shivay
const express = require('express');
const app = express();
app.use('/', (req, res) => {
res.json({ 'message': 'Hello from Node!' });
});
@thoughtspeed7
thoughtspeed7 / requirements.txt
Created June 5, 2018 15:37
Node, Python and Go in a single Google App Engine project!
Flask==1.0.2
gunicorn==19.8.1
@thoughtspeed7
thoughtspeed7 / python-app.yaml
Created June 5, 2018 15:33
Node, Python and Go in a single Google App Engine project!
# om namah shivay
# See https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml
# and https://cloud.google.com/appengine/docs/flexible/python/reference/app-yaml for more info
runtime: python
runtime_config:
python_version: 3
env: flex
service: python