Node js npm httpp-proxy vs http-proxy - node.js

I want to create a proxy-server in Node.js and I'm trying to figure out what npm-package to use. I recently read some people are trying to create malware packages with similar names to frequently used npm-packages (typosquatting, source). That made me suspicious when I saw the name 'httpp-proxy' just before installing.
Does anyone know the difference between the http-proxy and httpp-proxy packages?

I looked into http-proxy and it looked like it had a big community
262,764 downloads in the last day
1,604,883 downloads in the last week
6,922,320 downloads in the last month
You can safely use that

Related

How can I recreate the same env from a GitHub

I update an old repo: https://github.com/cbartel/nw-company-tool The creator of this project created a tutorial which explains how to install everything, only if you use his node distribution.
My question is: how do I recreate the same node distribution using the files in the tar.gz release?
What are the steps? Installing nest? then what? should I install angular? or? Should I run the build.ts? I don't know from where should I start. I come from Python. I know basic html, but I don't know how prisma, angular, nest, node and everything work.. I read and watch tutorials about the basic, but I still don't know where should I start for making that GitHub work on my Ubuntu server without using the guy's node distribution.
Can someone be so kind to check his repo and tell me from where to start? Will be really appreciate. I spent 40+ hours trying to start all .ts file but only with errors and unsuccessfully.
I tried to run in terminal the commands the ts script use, but got the same errors.
what am I missing?
I tried every command I found on the internet to fix the errors, but created just more errors.
I'm using Digital Ocean Ubuntu 20 as server with domain buy from ionos.
I try to run line of commands present in the files build.ts and other ts files. nothing works.
If I use his node distribution I get 0 errors. but the files are changed, and for doing 1 update, or add some data, I need to change 12 js files or more, that's why I'm trying to setup my distribution so I can edit just 4 files and everything should work fine, but I don't know how to create the same node distribution the guy released on his GitHub. I'm using his same files and I don't understand what is wrong.

When to add a dependency? Are there cases where I should rather copy the functionality?

I lately helped out on a project, where I added a really small dependency - in fact, it only contained a regular expression (https://www.npmjs.com/package/is-unc-path).
The feedback I got from the developer of the project was that he tries to minimize third-party dependencies if they can be implemented easily - whereby he - if I understand it correctly - asks me to just copy the code instead of adding another dependency.
To me, adding a new dependency looks just like putting some lines of code into an extra file in the repo. In addition, the developers will get informed by an update if the code needs a change.
Is it just a religious thought that drives a developer to do this? Are there maybe any costs (performance- or space-wise, etc) when adding a dependency?
I also had some disputes with my managers once concerning the third party libraries, the problem was even greater he got into believing that you should version the node_modules folder.
The source of any conflict usually is the ignorance.
His arguments were:
you should deliver to the client a working product not needing for him to do any other jobs like npm install
if github, npm is down in the moment when you run npm install on the server what you will do ?
if the library that you install has a bug who will be responsible
My arguments were:
versioning node_modules is not going to work due to how package dependencies work, each library will download his own node_modules dependencies and then your git repository will grow rapidly to hundreds of mb. Deploy will become more and more slow, downloading each time half a gb of code take time. NPM does use a module caching mechanism if there are no changes it will not download code uselessly.
the problem with left-pad was painfull but after that npm implemented a locking system and now for each package you just lock to a specific commit hash.
And Github, and npm does not have just a single instance service, they run in cloud.
When installing a dependency you always have some ideas behind and there are community best practices, usually they resume to: 1. Does the repo has unit tests. 2. The download number 3. When was the latest update.
Node.js ecosystem is built on modularity, it is not that node is so popular cause of some luck, but cause of how it was designed to create modules and reuse them. Sometimes working in node.js environment feels like putting lego pieces together and building your toy. This is the main cause of super fast development in node.js. People just reuse stuff.
Finally he stayed on his own ideas, and I left the project :D.

How could I download many NPM modules without npm install?

Okay, so I get it that I might be looking for a totally unexpected behavior.
My current company has nothing for me to do for a few weeks, so I would like to start a side project. The problem is, the firewall is really strong here, so I cannot download anything with Git or Npm. I also am not allowed to do any request to the IT support, since I am not in my company's office but some offices owned by a client (that applies said strict policy). In short, I am stuck with firewall and proxy policies that I cannot modify.
I may download a module's zipped archive through the browser, and install it from there. However, it has multiple dependencies, that themselves have dependencies, and so forth. And since I cannot run npm install to retrieve the dependencies, I'm stuck.
I saw multiple possible solutions in order to solve those dependencies issues:
make NPM run all requests and downloads through the browser, since browsers are allowed to access to the network. I don't see any options for that so far.
Download all required dependencies as tarball and step-by-step install each of them. Because of the potential number of dependencies being huge, I am looking for a huge bulk of modules commonly used to download once.
Most solutions I find make the assumption that I may use npm install properly, while my proxy doesn't allow it.
I wouldn't like to spend days on Chrome's built in game. Any idea?
maybe you can create the project somewhere else, and then "import" it on your office local machine:
npm init
edit package.json with your dependecies
npm install
put everything on usb stick and put it on your local computer at work.
or
send an archive of the code via email and download the tarball from email at office.

Can't access socket.io

this might be a bit of a silly question but it's something that i've been struggling to find the answer to and for some reason it doesn't seem to be evident from the tutorials and websites i have been reading, so maybe it's something that is assumed that i'm really missing.
So anyway, i installed node.js and then used the command npm install socket.io. it them proceeds to download and install a bunch of files, i don't see any error with this process in the command line.
So now i've tried to access socket.io like this:
<script src="/socket.io/socket.io.js"></script>
Like it shows on the socket.io website, however i get an error saying the file isn't found..... my first guess is that the installation of node.js and stocket.io are both on the local machine (program files) and not in the htdocs.
I have tested this one two platforms, first was my localhost which is Windows 7 running XAMPP on it, and i installed node.js and stocket.io globally (Program files). Second was my Windows server that uses IIS still get the error.
So my question is, how do i reference the stocket.io API and start using it based on the installations i have?
Thanks for your time.
npm isntall socket.io installs Socket.IO in a local node_modules folder so that the library is accessible to you in your own Node.js applications. You still need to create (and run) a Node.js application that loads up the module and sets up an HTTP server that uses the module; the examples under How to use in the project readme is a good starting point, although preexisting knowledge of Node.js will be helpful. You might check out Node.js Tutorial with Socket.IO if you're looking for additional information.

how to install git+node+npm in /home/user?

I would like to have a self-installation script that i could use to have several installations of git + node.js + npm, all working in isolation in userland (with requiring root access).
One of the goal is to have a continuous integration setup that would
isolate installation of several branches/tags
recompile the bundle from source everytime
I suspect that such a script already exists somewhere but could not find one.
Is there a best-practice somewhere that I am missing ?
Thank you for your help
i don't understand why you'd want to have isolated copies of git, but for node and npm check out this blog post.

Resources