Journal
Today is officially the first Sunday that I am going to go over all of my notes from this week and organize them into coherent thoughts and place them in their respective areas. The new sections of this week are Grafana and Node.js. I will probably make a programming directory with programming languages and make a sub directory for Node.js in a Javascript directory.
Probably do something similar with Observability.
Today I am kicking off learning Node.js while also trying to implement Grafana into the mix.
Had a thought today that it might be a cool idea to build a Web Application security version of Free Code Camp or at least a stitched together place for free resources like OSSU
Raw Notes
- NPM
- We can install npm in our node application and add commands to the JSON file to make commands
- For example look at these scripts that are located in the package.json file. the start command is ran by stating
npm start
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
-
Installing 3rd party packages with
npm
-
Grafana Alloy
- Takes a long time to install.
- Followed instructions here
- very vague on where to configure things
-
Getting Grafana Alloy to work with Node.js
- This was hell and I am going to have to re explore this tomorrow.
-
Node.JS - the three types of errors
- Syntax Errors
- Runtime Errors
- Logical Errors
-
Node.js Debugger
- use this especially when you have Logic errors that do not give you any information
- Basically he was talking at me while I was stewing on Grafana. However he recommended to look at this https://code.visualstudio.com/docs/nodejs/nodejs-debugging
- And this to an extent
- Might need to come back to this debugger module if I need more here.
-
Express.js
- There are a lot of alternatives
- Express is the most popular
-
NPM commands
npm install --save
will save to everythingnpm install --save-dev
will install only to dev
-
Express Middleware
- Express is all about Middleware
-
Express.js - next()
- a pass through function that is also required to contionue the request to the next middlleware
- go further
-
Express.js - res.send()