Posts

Showing posts from February, 2019

Multiple React bundles on a single Express server (Part-1)

This is the sharing about setting up multiple React Apps to be hosted by a single Express server. Most of the web projects do not require this kind of setup. In common practice, an Express server usually just hosts one React App. This should be the way to go most of the time. ------------------------------------------------------------------------ | | | ------------- ------------------ | | | React App | <------------> | Express server | | | ------------- ------------------ | | | ------------------------------------------------------------------------ In my current project, there is a need to have separate React Apps to be hosted by a single Express server. This is to allow control on user access while using a single Docker container. -------------

Setting Up Syntax Highlighter In Blogger (Part-2)

In the previous post, I wrote part one of Setting Up Syntax Highlighter In Blogger . I like the font, the auto line number and the colour on the coding syntax. But there is one problem with the setup. The syntax highlighter seems outdated, not really highlighting latest programming syntax (eg. 'const' in ES6 Javascript) I went to check around if there is another way, and I found one. After finishing setting up, this is the result: const array1 = [1, 2, 3, 4]; const reducer = (accumulator, currentValue) => accumulator + currentValue; // 1 + 2 + 3 + 4 console.log(array1.reduce(reducer)); // expected output: 10 // 5 + 1 + 2 + 3 + 4 console.log(array1.reduce(reducer, 5)); // expected output: 15 var array1 = ['a', 'b', 'c']; array1.forEach(function(element) { console.log(element); }); // expected output: "a" // expected output: "b" // expected output: "c" If the syntax highlighting colour look familiar t

Setting Up Syntax Highlighter In Blogger (Part-1)

Today, I tried to find a way to do syntax highlighting to the code sample in my blog post. Using my custom CSS, this is what happened before I embedded the syntax highlighter. const array1 = [1, 2, 3, 4]; const reducer = (accumulator, currentValue) => accumulator + currentValue; // 1 + 2 + 3 + 4 console.log(array1.reduce(reducer)); // expected output: 10 // 5 + 1 + 2 + 3 + 4 console.log(array1.reduce(reducer, 5)); // expected output: 15 var array1 = ['a', 'b', 'c']; array1.forEach(function(element) { console.log(element); }); // expected output: "a" // expected output: "b" // expected output: "c" This is what happened after I embedded the syntax highlighter. const array1 = [1, 2, 3, 4]; const reducer = (accumulator, currentValue) => accumulator + currentValue; // 1 + 2 + 3 + 4 console.log(array1.reduce(reducer)); // expected output: 10 // 5 + 1 + 2 + 3 + 4 console.log(array1.reduce(reducer, 5)); // expected ou