3 ms·
Was curious if author considers node libs like `http` a dependency and the answer is no they don't. Looks like they're defining a dependency as an npm module, w
by a13n 3y ago
Was curious if author considers node libs like `http` a dependency and the answer is no they don't. Looks like they're defining a dependency as an npm module, which seems pretty fair.
- tobyhinloopen 3y ago(author here) Anything that's available to you, without configuration, after installing nodejs and starting the application. That includes the whole NodeJS standard library and maybe standard (or extremely common) utilities available on the server (curl, git, ls, find, sed, etc). I still have to find a way to store data and I really don't want to create my own database, but I haven't found a database in the standard library.
- marcus_holmes 3y agoThis is analogous to Go. The interface for databases is in the std lib, but that actual implementation of that interface is not. If you want to use Postgres in Go, you have to pick a non-std package (or write your own). I'd consider this an acceptable import ;)
- eyelidlessness 3y agoYour comment got me curious if it’s at all possible to build a Node web service without importing any Node modules (ie with just the global/module-local namespace). Glancing at the globals docs, I think you’d be limited to WASM, binary extensions (like N-API), or maaaaaaybe doing something horrifically hacky with CJS require.
- tomashubelbauer 3y agoYou can also use HTTP ESM imports which is how I like to build dependencies for my personal projects. In Node I think you still need a special loader for this, in Deno, this is a native feature.
- DecoPerson 3y agoIf you’re OK importing node’s internal modules [0], which I believe are loaded anyway, you could achieve a lot, though it definitely wouldn’t be worth it. No developer is an island. [1] [0] https://github.com/nodejs/node/tree/main/lib/internal https://github.com/nodejs/node/tree/main/lib/internal [1] https://youtu.be/TY9xsT6S75A?si=uqPUuxKNl_1vqMhm https://youtu.be/TY9xsT6S75A?si=uqPUuxKNl_1vqMhm
- wiseowise 3y agoStd is not a dependency.