Questions tagged as 'node.js'

1
answer

Pass variable in query MongoDB (JAVASCRIPT)

With this query: const result = await Topic.find( { 'categorieName': { $regex: /^news/i } } ) I can return the categories with news name, the problem is that it is not always news, so I wanted to put a variable in place How do I do this?...
asked by 03.01.2019 / 20:12
2
answers

Error passing arguments in JSON

I'm trying to make an insertion in MongoDB by passing some arguments in JSON: { "name": "TESTE", "category": "B", "service": "Novo processo", "description": "Novo Teste", "active": false, "classmodels": [ {"...
asked by 19.10.2018 / 20:42
1
answer

req.body does not work on Express

I'm trying to read parameters sent via post, but express only shows in empty console.log objects. This is the code import * as jsonServer from 'json-server' import {Express} from "express"; import * as fs from 'fs' import * as https from 'h...
asked by 31.08.2018 / 18:00
2
answers

Return to previous page after signing in

I've set up a site where the user logs in by entering any Login and Password and storing it in LocalStorage. Which part of the site he tries to access always redirects to the Login page if he has not logged in at least 1 time. (Example: if it tr...
asked by 31.08.2018 / 18:53
1
answer

Status e-mail - nodemailer

Whenever I send a message using the nodemailer I have how to get the messageId example:    messageId: [email protected] Is it possible to make an appointment to check the status of this email? such as whether...
asked by 27.11.2018 / 20:28
1
answer

Unit Test - How to check for an expected error?

In a unit test for a module using Mocha and Chai , I need to check if an error is returned if the parameter format is invalid. The function of the module in question returns a Promise . The example below is fictitious bu...
asked by 01.08.2018 / 04:21
1
answer

Bug multiples modals bootstrap

I have two modals on the same page, one to change and another to remove information from the bank. The code for the first modal is this: <!-- Modal Editar --> <div class="modal fade" id="myModal"> <div class="modal-dial...
asked by 04.07.2018 / 22:57
1
answer

What is the best way to make a function of a "Node" file be called on my HTML5 site?

I'm doing a project of a simple music player using ElectronJS. For this I'm using a library that plays MP3 files (play-sound), how can I call this function inside my HTML? Do I need to create another file just for sound reproduction or can I p...
asked by 10.10.2018 / 02:04
1
answer

Use global variable in Typescript with NodeJS

I'm looking for a way to use global variable in typescript with NodeJS. For example in js I can do: //init.js global.foo = "foo"; //teste.js var foo = global.foo; Is there any way I can do this in typescript? PS: I know it's not good pr...
asked by 07.09.2018 / 18:43
1
answer

How to list files in a directory and use in an Angular2 + Webpack project

Hello, I'm creating a project in Angular2 + Webpack and in this project I use the @angular/material as the design library. So that I can create my own icons using SVG, I'm extending the component MatIcon as it says in the documentation...
asked by 19.06.2018 / 14:31