Node.js
- github.com array items grow as form is resubmitted & fields always an array? · Issue #979 · node-formidable/formidable
Support plan Which support plan is this issue covered by? (Community, Sponsor, Enterprise): Community Currently blocking your project/work? (yes/no): No Affecting a production system? (yes/no): No ...
When I submit the form twice, three times, etc. I get duplicated form field data. Here is the console output of the form data after every submissions.
Also all the field values are always an array, even if the input field for that value is a text input field? Not sure if this is another issue or not.
Here is my code. Only one JS file and one HTML file...
``` import fs from 'fs'; import http from 'http';
import { formidable as formidablePackage } from 'formidable';
const port = 8080;
//Will create horizontal line that will fit the width of the terminal window const horizontalLine = '='.repeat(process.stdout.columns);
const formidable = formidablePackage({ allowEmptyFiles: true, minFileSize: 0, });
http .createServer(async (request, response) => { if (request.method === 'POST') { let [formFieldData, formFileData] = await formidable.parse(request);
console.log(formFieldData); }
response.setHeader('Content-Type', 'text/html');
fs.createReadStream('form.html').pipe(response); }) .listen(port); ```
<form method="post" enctype="multipart/form-data"> <input name="myText" /> <br /> <input type="checkbox" name="myCheckboxGroupA" /> <input type="checkbox" name="myCheckboxGroupA" /> <input type="checkbox" name="myCheckboxGroupA" /> <br /> <input type="file" name="myFileA" /> <br /> <input type="file" name="myFileB" multiple /> <br /> <input type="file" name="myFileC" multiple directory webkitdirectory /> <br /> <input type="submit" /> </form>
These are the console logs
$ node form.js { myText: [ 'hello world' ], myCheckboxGroupA: [ 'on' ] } { myText: [ 'hello world', 'hello world' ], myCheckboxGroupA: [ 'on', 'on' ] } { myText: [ 'hello world', 'hello world', 'hello world' ], myCheckboxGroupA: [ 'on', 'on', 'on' ] } { myText: [ 'hello world', 'hello world', 'hello world', 'hello world' ], myCheckboxGroupA: [ 'on', 'on', 'on', 'on' ] }
These are the console logs I expected
$ node form.js { myText: 'hello world' , myCheckboxGroupA: [ 'on' ] } { myText: 'hello world' , myCheckboxGroupA: [ 'on' ] } { myText: 'hello world' , myCheckboxGroupA: [ 'on' ] } { myText: 'hello world' , myCheckboxGroupA: [ 'on' ] }
- logtape.org LogTape
Simple logging library with zero dependencies for Deno, Node.js, Bun, browsers, and edge functions
- nodejs.org Node.js — Node v22.9.0 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- github.com Release 5.0.0 · expressjs/express
What's Changed 4.19.2 Staging by @wesleytodd in #5561 remove duplicate location test for data uri by @wesleytodd in #5562 feat: document beta releases expectations by @marco-ippolito in #5565 Cut ...
- docs.timetime.in JS Dates Are About to Be Fixed | TimeTime
Why I’m excited about the new Temporal API in JavaScript: finally, easy and accurate date handling with time zones using ZonedDateTime. Say goodbye to the headaches of traditional Date objects.
- nodejs.org Node.js — Node v20.16.0 (LTS)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- github.com module: add --experimental-strip-types by marco-ippolito · Pull Request #53725 · nodejs/node
It is possible to execute TypeScript files by setting the experimental flag --experimental-strip-types. Node.js will transpile TypeScript source code into JavaScript source code. During the transpi...
- nodejs.org Node.js — Node v22.5.1 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v22.5.0 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v22.4.1 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v20.15.0 (LTS)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v20.13.1 (LTS)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v22.1.0 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- openjsf.org Node.js 22 Available Now | OpenJS Foundation
The release of Node.js 22 is available now! Highlights in Node.js 22 include require()ing ESM graphs, WebSocket client, updates of the V8 JavaScript engine, and more!
- eslint.org ESLint v9.0.0 released - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
- nodejs.org Node.js — Tuesday, April 9, 2024 Security Releases
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
The Node.js project will release new versions of the 18.x, 20.x, 21.x releases lines on or shortly after, Tuesday, April 9, 2024 in order to address:
- 1 high severity issues.
- 1 medium severity issues.
- nodejs.org Node.js — Node v21.7.2 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Wednesday, April 3, 2024 Security Releases
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
The Node.js project will release new versions of the 18.x, 20.x, 21.x releases lines on or shortly after, Wednesday, April 3, 2024 in order to address:
- 1 medium severity issue.
- 1 high severity issue.
- astro.build Migrating 500+ tests from Mocha to Node.js | Astro
A retrospective of how Astro migrated more than 500 test suites from Mocha to Node.js test runner.
- • 100%joyeecheung.github.io require(esm) in Node.js
Recently I landed experimental support for require()-ing synchronous ES modules in Node.js, a feature that has been long overdue. In the pull request, I commented with my understanding about why it di
- • 100%www.sonarsource.com __dirname is back in Node.js with ES modules
Node.js is reducing friction when using ES modules by making it easier to get the current module directory name
cross-posted from: https://programming.dev/post/11927506
> Many times when I’ve tried to write some code in Node.js using ES modules I’ve found myself reaching for __dirname and then looking up how to replace it. Now Node.js, Deno and Bun support import.meta.dirname. Check out the article for more detail.
- nodejs.org Node.js — Diving into the Node.js Website Redesign
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- github.com GitHub - nvm-sh/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm-sh/nvm
- gist.github.com The absurd complexity of server-side rendering
The absurd complexity of server-side rendering. GitHub Gist: instantly share code, notes, and snippets.
- • 100%blog.rafaelgss.dev Node.js 2023 Year in An Article
Tech insights on Performance, Security and Node.js from Rafael Gonzaga, Node.js TSC member
- • 100%
Here's a reminder that the good people behind Express.js are currently working on Express 5, currently in beta.
- • 100%stacklok.com How npm install scripts can be weaponized: A real-world example of a harmful npm package
How npm preinstall and postinstall scripts can serve as methods to inject malicious code into open source packages.
- • 100%
Node v21.7.1
nodejs.org Node.js — Node v21.7.1 (Current)Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v21.7.0 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v21.6.2 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
v20.11.1 - https://nodejs.org/en/blog/release/v20.11.1 v18.19.1 - https://nodejs.org/en/blog/release/v18.19.1
- nodejs.org Node.js — Tuesday February 6 2024 Security Releases
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v21.6.1 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node.js — Node v21.6.0 (Current)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- nodejs.org Node v20.11.0 (LTS) | Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
Hi y'all, sorry if these are really basic questions, but I'm just starting out learning node. I've been developing software for a long time, and web sites / apps for a couple of years, but nothing too advanced yet, mostly in vanilla HTML/JS and a little PHP. I swear I am trying to keep an open mind on all of this but some of these ideas are really new / different for me.
-
Is Express really just for API development, or can I use it to create a basic web app as well? (I've read others saying this but I find this idea confusing -- e.g.: https://alternativeto.net/software/expressjs/ "Express is for building REST APIs (backend). Meteor is for building the full stack webapp")
-
Do you get used to the idea of incorporating other people's code into your node projects? (Because as an older developer, all this "just add this framework which has 122 dependencies of its own" seems like mania. How could you ever say a project built on hundreds of other projects [which all have their own dependencies too] could ever be said to be safe or secure? And won't changes in those projects break my project eventually?)
-
Is there no way to process a POSTed form with just the built-in Node functions when the form enctype is "multipart" -- without adding in Express or some other framework? (I've searched and searched and all the examples I found for doing this without Express assume the form's enctype is "x-www-form-urlencoded" but my form will be used to upload a file.)
Thanks for any advice / info!
-
- chat-to.dev Chat Rooms and Programming Content | Chat-to.dev
Join chat rooms and explore programming content on Chat-to.dev.
For those learning Nodejs, here is a tutorial on how to handle HTTP POST requests.
- github.com GitHub - goldbergyoni/nodebestpractices: :white_check_mark: The Node.js best practices list (December 2023)
:white_check_mark: The Node.js best practices list (December 2023) - GitHub - goldbergyoni/nodebestpractices: :white_check_mark: The Node.js best practices list (December 2023)
- stackdiary.com The Most Popular Node.js Frameworks - Stack Diary
As the demand for robust and scalable web applications continues to increase, Node.js remains a popular choice among developers. Node.js is a powerful open-source JavaScript runtime environment that allows developers to build fast and efficient applications. And with so many Node.js frameworks avail...
- nodejs.org Node v21.5.0 (Current) | Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- www.npmjs.com better-node-inspect
A modern node inspector optimized for command line usage (like ipython, pry, iex, etc.). Latest version: 0.3.3, last published: 4 months ago. Start using better-node-inspect in your project by running `npm i better-node-inspect`. There are no other projects in the npm registry using better-node-insp...