Check if post exist if not create a new post

I want to validate to check if a post exist in the database if it doesn't create it. Var post is a json date that we getting from an api, and every time we run this route we hit the api which adding the same data multiple times. I want to validate...
more »

2017-08-15 22:08 (0) Answers

Nodemailer started to give an error out of nowhere

I've been using Nodemailer in my app for about a year now without problems, but today I started to get the following error on all mail instances { [Error: self signed certificate] code: 'ECONNECTION', command: 'CONN' } I haven't touched this code ...
more »

2017-08-15 00:08 (0) Answers

Conditional Statement Within Map Loop

In ReactJS, I am trying to call an if statement within a map loop. An example code is this: var items = ['abc', '123', 'doe', 'rae', 'me']; return ( <div> {, index) => ( <span dangerouslySetInnerHTML...
more »

2017-08-14 03:08 (2) Answers

NodeJS webpack building in docker container

I read this about long-term caching and tried to implement this in my project, but the manifest file generates wrong links to assets when I'm trying to build it in docker container, but generation process works well. Dockerfile.web FROM node:8.2.1-...
more »

2017-08-13 07:08 (1) Answers

Mongoose validate Schema with no Model

I want to validate some inner elements of an object against schemas that are members of a larger schema before posting that object on the model correspondent to that larger schema. Someone already asked this question and this answer has something si...
more »

2017-08-12 09:08 (0) Answers

Promise handling - update db entry if exists

I am stuck with new challenge on Promises. Goal: Update the DB entry only if P_KEY exists. current db is exposed through module and module has get and put method for db. Both returning Promise. Approach: API calls for update method handler o...
more »

2017-08-12 07:08 (2) Answers

node.js | Redis cache loading old data

I am trying to setup a mongo, node and redis server and all is working well other than the Redis cache which seemingly loads the older data. Taking Redis out and using pure Mongo returns the right data, and if I click submit again it will load the d...
more »

2017-08-10 21:08 (1) Answers

User account database in cansecurity

I'm creating some toy applications and i need SSO and API authorization for multiple RESTful node.js/ Express applications. I discovered cansecurity can do the job. But i don't understand where does the user account information reside. From the gith...
more »

2017-08-10 20:08 (0) Answers

How to validate a string field in sequelize.js?

How can I validate a database field to accept just a string? In my database, I have two fields: description: String completed: Boolean I want the description field accept just a string value. What I mean is: 'description':'text' => database a...
more »

2017-08-09 17:08 (1) Answers

Logging incoming requests in BotBuilder

Trying to log all incoming requests from Facebook so I can inspect the object I get back to do some stuff with the built in NLP Facebooks implemented. I, however, can't seem to find anywhere where it tells me I can console.log incoming requests. in...
more »

2017-08-09 15:08 (1) Answers

NodeJS - why serial reader is failing?

I have installed serialport using npm, but why its failing to connect? $ ls /dev/tty.* /dev/tty.Bluetooth-Incoming-Port /dev/tty.usbserial-AI0255BX $ cat /var/tmp/test.js var SerialPort = require('serialport'); var port = new SerialPort('/dev/tt...
more »

2017-08-09 10:08 (1) Answers

Avoid image blinking when back button is hit

I'm developing a web interface with an Instagram-like navigation. This means that I have a grid of pictures and when I click on one of these I go to another page that shows me the details of the image that I clicked. Then the user can go back by clic...
more »

2017-08-09 05:08 (2) Answers

node.js (with security?

since I am learning node.js I was wondering about something: When I use node.js server to run a websocket, so that clients can connect (like on a website via javascript), it always listens public. Isn't that a security problem, that everyone in the w...
more »

2017-08-09 01:08 (0) Answers

Node.js event loop understanding (with a diagram)

I've read this and this, watched this... I've made a diagram of how I understand it: Javascript callbacks (functions) can be present in the current queue, check queue, close callbacks queue, timers queue and I/O callbacks queue. Js code gets exe...
more »

2017-08-08 12:08 (0) Answers