Setting Up Google Analytics

I am fascinated by how simple it is to set up Google Analytics for my site. All I did, was a few simple steps to make it working on my Hugo blog. Create a Google Analytics Account and Property (website) Get the measurement ID G-2FGC0xxxx, found under Admin–>Data Streams of Analytics Dashboard and paste it into config.yml, like so: 1 googleAnalytics: G-2FGC0CNJX2 And that’s it! That’s all it takes for Google Analytics to work and begin capturing data on your site. Usually, an additional step is needed for you to paste the JS code into the sections of the sites you want to capture data for (usually the headers), but for this particular theme, you don’t have to. ...

August 20, 2021 · 1 min · Lei

Express: Auto Server Refresh Feature

One problem with the simple Express server is that you have to restart the application every time there is a change to the source code to see the changes implemented. By installing nodemon, you have an “auto-refresh upon source code save” feature. Step 0: Go to Express project root. Step 1: Install nodemon npm install --save-dev nodemon Step 2: Add the following line: "dev": "nodemon index.js" to package.json 1 2 3 4 5 "scripts": { "start": "node index.js", "dev": "nodemon index.js", "test": "echo \"Error..."" }

August 16, 2021 · 1 min · Lei

Steps for creating an Express Server

It is really simple creating an express API server. All you have to do is basically requiring express, creating/importing the JSON data, setting up a route, setting up a listening port, and bam there is API access to your data. Steps for creating an Express API server: Step 1: Importing Express, assigning it to app variable 1 2 const express = require('express') const app = express() Step 2: Creating JSON data ...

August 16, 2021 · 1 min · Lei

Express App.listen

What I’ve found is that if I don’t add the following code to my index.js file, I am not able to run the localhost: 1 2 3 app.listen(PORT, () => { console.log(`Server running on port ${PORT}`) }) The code still runs when you do npm start, but upon end of code, it simply terminates, whereas if you do app.listen, you could inspect the output at a port.

August 16, 2021 · 1 min · Lei

Steps for creating an NPM server

Step 1: npm init in project folder Step 2: Add "start": "node index.js" in package.json, like so: 1 2 3 4 5 6 { "scripts": { "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 1" }, }

August 16, 2021 · 1 min · Lei

This is a new note

Hello thius is a sample note

August 13, 2021 · 1 min · Lei