Questions tagged as 'node.js'

1
answer

Remove files with File System

I'm trying to remove two files from my server with the following code: const fs = require('fs'); const express = require('express'); const app = express(); app.delete('/delete', function(req, res){ fs.unlink('path/doc_1', function...
asked by 22.08.2018 / 14:15
1
answer

Creating a CLI tool with NODEJS

I'm learning how to create a Command-Line Interface Applications (CLI) tool and performed the following steps: I created a folder and inside it in the terminal rodei npm init--yes In this folder, I created the package.json in t...
asked by 17.05.2018 / 22:15
1
answer

How to use other HTTP methods in HTML forms?

I'm using Express.JS to do a CRUD on NodeJS. I was trying to make use of the new HTTP methods, such as put , but when I put it in the method attribute of the form it does not seem to work. The form code: [...] <form action="/p...
asked by 25.02.2018 / 16:08
1
answer

The insert of the Node express with problem

I'm new as a Node Express programmer with Mysql, I created the implementation to save, however he created the registry with null in the table, see how I performed the test in postman; This is my entity; module.exports = (sequelize, Se...
asked by 30.07.2018 / 13:39
1
answer

Add variables to columns (MySQL)

I have a question, is it possible to add variables in a column? Test Code var sql = "INSERT INTO sometable (someparam) VALUES (varToParam)"; con.query(sql, function (err, result) { if (err) throw err; console.log("test"); });...
asked by 31.08.2017 / 20:16
1
answer

Make json remote in string

How can I return the value of a remote json and read it as a string, eg when I get json it prints the entire result as in the image below. codebelow:varhttps=require('https');varoptionsget={host:'the-evie.com',port:443,path:'/playerscript/pc/Dr...
asked by 19.09.2017 / 07:00
1
answer

NodeJS: Difference between requisitions (require)

I started learning NodeJS and noticed that there are some ways to request a file, two of them are: const app = require('lib').app const {app} = require('lib') Is there any difference between them in performance or are they...
asked by 11.08.2017 / 18:11
2
answers

Error with Electron + Serialport to use Arduino

I'm having trouble running an application made with Electron, Serialport, and Node.Js to communicate with an Arduino. I have the following error: App threw an error during load Error: Uma rotina de inicialização da biblioteca de vínculo...
asked by 01.10.2017 / 23:59
1
answer

What is the function of app.listen in Express?

Recently I started my studies in NodeJS and Express. From what I've been reading, app.listen, basically, is what makes the server listen for requests coming from the defined port. But I noticed that when running an application in Express it r...
asked by 14.08.2017 / 19:52
2
answers

Query return in Javascript variable

I am making a code in node.js that accesses SQL Server database. I created a variable that stores the result of a query, the problem is that I can not access this variable outside the connection method to the database. Here is the code: var le...
asked by 09.06.2017 / 20:57