javascript
-
Hỏi đáp
In Node.js, how do I “include” functions from my other files?
Let’s say I have a file called app.js. Pretty simple: var express = require('express'); var app = express.createServer(); app.set('views', __dirname…
Đọc thêm » -
Hỏi đáp
Error: Can’t set headers after they are sent to the client
I’m fairly new to Node.js and I am having some issues. I am using Node.js 4.10 and Express 2.4.3. When…
Đọc thêm » -
Hỏi đáp
How do I get started with Node.js [closed]
Closed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet…
Đọc thêm » -
Hỏi đáp
Using Node.js require vs. ES6 import/export
In a project I am collaborating on, we have two choices on which module system we can use: Importing modules…
Đọc thêm » -
Hỏi đáp
Sending command line arguments to npm script
The scripts portion of my package.json currently looks like this: "scripts": { "start": "node ./script.js server" } …which means I…
Đọc thêm » -
Hỏi đáp
Where does npm install packages?
Can someone tell me where can I find the Node.js modules, which I installed using npm? Answers: Global libraries You…
Đọc thêm » -
Hỏi đáp
How can I get the full object in Node.js’s console.log(), rather than ‘[Object]’?
I have this object: const myObject = { "a":"a", "b":{ "c":"c", "d":{ "e":"e", "f":{ "g":"g", "h":{ "i":"i" } } }…
Đọc thêm » -
Hỏi đáp
What is the purpose of Node.js module.exports and how do you use it?
What is the purpose of Node.js module.exports and how do you use it? I can’t seem to find any information…
Đọc thêm » -
Hỏi đáp
Read environment variables in Node.js
Is there a way to read environment variables in Node.js code? Like for example Python’s os.environ['HOME']. Answers: process.env.ENV_VARIABLE Where ENV_VARIABLE…
Đọc thêm » -
Hỏi đáp
How do you get a list of the names of all files present in a directory in Node.js?
I’m trying to get a list of the names of all the files present in a directory using Node.js. I…
Đọc thêm » -
Hỏi đáp
How do I debug Node.js applications?
How do I debug a Node.js server application? Right now I’m mostly using alert debugging with print statements like this:…
Đọc thêm » -
Hỏi đáp
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
My version of node is always v0.6.1-pre even after I install brew node and NVM install v0.6.19. My node version…
Đọc thêm » -
Hỏi đáp
map function for objects (instead of arrays)
I have an object: myObject = { 'a': 1, 'b': 2, 'c': 3 } I am looking for a native…
Đọc thêm » -
Hỏi đáp
Writing to files in Node.js
I’ve been trying to find a way to write to a file when using Node.js, but with no success. How…
Đọc thêm » -
Hỏi đáp
How to decide when to use Node.js?
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not…
Đọc thêm »