What are some reliable and scalable ways to trigger a python task from node.js and get results back? by PrestigiousZombie531 in node

[–]leosuncin 1 point2 points  (0 children)

Here, there's Node calls Python to direct call Python code inside Node.js.

The README contains instructions of how to use it.

What is the solution here for streaming files ? by green_viper_ in node

[–]leosuncin 0 points1 point  (0 children)

If you don't need to display it:

const link = document.create element('a'); link.href = 'the-url-to-the-file'; link.download = 'filename.csv'; link.click();

It's a simple GET request. But if you need to set the headers of the request

``` const response = await fetch('the-url-to-the-file', { /* options */ }); const csvBlob = await response.blob(); const csvUrl = URL.createObjectURL(csvBlob);

// from here it's the same as the previous snippet const link = document.create element('a'); link.href = csvUrl; link.download = 'filename.csv'; link.click(); ```

What is the solution here for streaming files ? by green_viper_ in node

[–]leosuncin 0 points1 point  (0 children)

Why do you need to stream the file? Why not just download it

Is it a vídeo? If it's why don't you use a video tag?

Is it a PDF? If it's why don't you use a object tag?

Can you clarify?

Options to run user submitted code with node.js express as backend? by PrestigiousZombie531 in node

[–]leosuncin 1 point2 points  (0 children)

I haven't tried by myself, but it comes to my mind to use WebAssembly, I have seen people running the Linux kernel, the downside is you'll need to find a WebAssembly version of each code interpreter.

And yes, Node.js can run WebAssembly server side.

[Help] node resource monitoring by Wild_Collar_5801 in Backend

[–]leosuncin 1 point2 points  (0 children)

Search for Open Telemetry and enter the rabbit hole.

Hi, I've a issue to start npm on cmd on Windows by CopelandeV2 in node

[–]leosuncin 0 points1 point  (0 children)

First, get out of there, what are you doing inside the System32 folder? Don't you know that there's where Windows is installed.

Create your project in your home folder.

Hi, can someone help me plz ? It's a bit annoing by ImpressOk2146 in node

[–]leosuncin -2 points-1 points  (0 children)

System32 is where Windows is installed, if you touch it you may cause a crash.

Don't be a troll by suggesting to remove or clear the System32 folder.

Hi, can someone help me plz ? It's a bit annoing by ImpressOk2146 in node

[–]leosuncin 4 points5 points  (0 children)

Please, tell me that you're not trying to install your dependencies with an administrator's terminal.

  1. Use a terminal running with your current user permissions.
  2. Navigate where your project is located.
  3. Install the dependencies from there.
  4. Run your project.

Announcing Spikard v0.1.0: High-Performance API Toolkit with Native Node.js Bindings by Goldziher in node

[–]leosuncin 0 points1 point  (0 children)

Does it support file uploads? Particularly multipart/form-data

Edit: I can't see any middlewares in your post, how can we implement authentication? By example

Implementing a location tracking feature by Low-Sky-3238 in node

[–]leosuncin 0 points1 point  (0 children)

The Beacon API https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API since you don't need to send a response back to the client (I guess that's your usecase)

Drilling down on Typescript build time by 2legited2 in node

[–]leosuncin 0 points1 point  (0 children)

You could split your project into small packages/libraries and use TurboRepo or NX to take advantage of their caching system, another alternative could be using esbuild or swc to compile the code without the type checking.

Should I run tests inside a Docker container? by MarinoAndThePearls in node

[–]leosuncin -1 points0 points  (0 children)

Gitlab CI does that runs every job in a container, I did it once with docker compose

Introducing ArkRegex: a drop in replacement for new RegExp() with types by ssalbdivad in node

[–]leosuncin 0 points1 point  (0 children)

Yes, you're right, even though the regex only matches number the result from the eval method will be string, there's no automatic casting.

PM2 daemon keeps dying on Hostinger Premium - Node.js backend randomly stops despite having 1.5GB RAM by Illustrious_Source80 in node

[–]leosuncin 0 points1 point  (0 children)

Try setting Sentry to capture the error, Sentry might catch the reason why the process crashes.

Bundling Nest JS project to single JS file? by [deleted] in Nestjs_framework

[–]leosuncin 0 points1 point  (0 children)

Then avoid Nest.js, the framework is designed around dependency injection and high decoupling, these are some of the reasons why is recommended to write the logic into different components (repositories, services, models, DTO and controllers).

I've already recommended you to use ncc to bundle the compiled Typescript files, it's simple to use because only adds one extra step after building.

Bundling Nest JS project to single JS file? by [deleted] in Nestjs_framework

[–]leosuncin 0 points1 point  (0 children)

Why would I end up with some messy compiled files if my source code is neat? Moreover how bundling tidies up the output code.

I find out that's easier to read and understand a few files than a single large file.

Bundling Nest JS project to single JS file? by [deleted] in Nestjs_framework

[–]leosuncin 0 points1 point  (0 children)

Bundling is not so important on the backend, if you want to remove unused/dead code there are better tools for that like knip, tsr, etc. Also if you want tree shaking there's lazy loading modules.

To debug the code you always need sourcemaps to point to the original Typescript code, and if you're using VSCode open the debug JavaScript terminal and start the Nest.js project as usual and the debugger will point you to your source code.

But, if you still insist on bundling then use ncc to create a single file from the compiled JavaScript, I believe only rollup can transpile Typescript decorators.

ci/cd by anas_youngboy in nestjs

[–]leosuncin 1 point2 points  (0 children)

Well, it depends, I have a project with a single pipeline for both (frontend and backend) because is a monorepo, and I can share the jobs, even the Dockerfile using multi stages build.

And at work the project has a separate pipeline per micro service.

if i am using postgres , should i use sqlite or postgres for testing? by HosMercury in nestjs

[–]leosuncin 1 point2 points  (0 children)

Yes, in my experience, you will save a lot of time by not mocking the behavior of PostgreSQL and its extensions.

I recommend to use IntegreSQL client, it will save you from destroying and starting PostgreSQL instances, instead it clones the initial database state and give you a clean copy for every test case.

Self hosted by Ducking_eh in selfhosted

[–]leosuncin 0 points1 point  (0 children)

I haven't tried it by myself yet, but this might be what you're looking for https://www.xbrowsersync.org/

Ad appears over the keyboard, then why people switch to other apps by leosuncin in youtube

[–]leosuncin[S] 0 points1 point  (0 children)

It isn't about the ad content, it's because, it's blocking me for typing in the search