2024年3月5日 星期二

Node simple run server

# folder 

[andychung@shared-docker-builder test2]$ ls

node_modules  package.json  package-lock.json  public  server.js

 

#################################

# server.js

var fs = require('fs');

var host = '0.0.0.0';

var port = 8080;

var express = require('express');

const path = require('path')


var app = express();

// http://10.0.1.30/hello_vue.html

app.use(express.static(path.join(__dirname, "public")));

app.get("/", function(request, response){

  response.send("hello express");

});

app.get("/a", function(request, response){

  response.send(__dirname);

});

app.listen(port, host);

#################################

# package json
[andychung@shared-docker-builder test2]$ cat package.json
{
  "name": "y",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2"
  }
}

node and npm global

 

# global install

root@c329f82c119d:/# npm install -g sass-loader



# global  command

root@c329f82c119d:/# npm list -g

/usr/local/lib

+-- @vue/cli@5.0.8

+-- corepack@0.24.0

+-- list@2.0.19

+-- npm@10.2.4

`-- sass-loader@14.1.1




# global folder

root@c329f82c119d:/# ls -al /usr/local/lib/node_modules/

drwxr-xr-x. 3 root root  17 Mar  6 01:59 @vue

drwxr-xr-x. 4 root root 106 Jan 22 12:11 corepack

drwxr-xr-x. 7 root root 133 Mar  6 06:54 list

drwxr-xr-x. 7 root root 153 Jan 22 12:11 npm

drwxr-xr-x. 4 root root  90 Mar  6 06:54 sass-loader

Nodejs and npm and lodash

npm install lodash

#

ls -al node_modules#

jquery  lodash  neo-async  sass-loader

#
# node
Welcome to Node.js v21.6.1.
> const _ = require('lodash');
> const numbers=[1,2,3]
> numbers
[ 1, 2, 3 ]
> _.first(numbers)


# ref
https://www.digitalocean.com/community/tutorials/how-to-use-node-js-modules-with-npm-and-package-json

https://linyencheng.github.io/2022/09/27/relationships-between-frontend-and-backend/tool-npm/

https://linyencheng.github.io/2022/09/27/relationships-between-frontend-and-backend/tool-npm/

https://linyencheng.github.io/2022/09/27/relationships-between-frontend-and-backend/tool-npm/

2024年1月14日 星期日

zabbix agent2 check

 https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/444439-agent2-bug-system-run-is-unsupported


https://www.zabbix.com/forum/zabbix-help/426010-unable-to-run-system-run

2024年1月9日 星期二

teams CAA50021 Error

 1.  download  請下載 WPJCleanUp.zip


https://learn.microsoft.com/zh-tw/office/troubleshoot/activation/reset-office-365-proplus-activation-state

2023年12月26日 星期二

how to umount storage with busy, linux

 https://linuxhandbook.com/umount-target-busy/

firefox add-on

 1. https://support.mozilla.org/en-US/kb/unable-install-add-ons-extensions-or-themes


2. use live host


LiveHosts