Skip to content

Instantly share code, notes, and snippets.

View frankxiao008's full-sized avatar

Saihong(Frank) Xiao frankxiao008

View GitHub Profile
@bradtraversy
bradtraversy / node_redis_cache.js
Created August 20, 2019 12:55
Node.js & Redis Caching
const express = require('express');
const fetch = require('node-fetch');
const redis = require('redis');
const PORT = process.env.PORT || 5000;
const REDIS_PORT = process.env.PORT || 6379;
const client = redis.createClient(REDIS_PORT);
const app = express();
@danschumann
danschumann / Step 1 -- Backend .js
Last active January 4, 2021 16:39
How to pass an object from nodejs to frontend
myObject = { ... }
this.injectString = JSON.stringify( myObject ).replace(/\\/g, '\\\\').replace(/"/g, '\\\"')