This file contains hidden or 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 http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Sample Program to Render Image after a defined Time</title> | |
</head> | |
<body> | |
<h1>Render Image after a defined Time</h1> |
This file contains hidden or 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
{ | |
"name": "express-web-server", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"start": "node simpleRoute.js" | |
}, | |
"keywords": [], |
This file contains hidden or 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
/* | |
using the memCache using the javascript | |
1. we are implementing to reduce the response time, no other data space is being used. | |
2. Better approach to solve most of the clientside optimizaition. | |
*/ | |
function memCache(func){ | |
var cache = {}; | |
return function(){ | |
var key = JSON.stringify(arguments); |
This file contains hidden or 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
// es6 syntax | |
var arr = ["a","b","c"]; | |
var str = "Hello {1} is a friend of {2} and {3}"; | |
var result_es6 = arr.reduce((str_data, replacement, idx) => { | |
return str_data.replace(`{${idx + 1}}`, replacement) | |
}, str); | |
console.log(result_es6); // "Hello a is a friend of b and c" |
This file contains hidden or 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'; | |
// simple express server | |
var express = require('express'); | |
var app = express(); | |
var router = express.Router(); | |
var port = 5001; | |
app.use(express.static('public')); | |
app.get('/', function (req, res) { |