Tag: node.js

how to reconnect to a docker container

I have a docker container running ubuntu and a simple node express site. I connected to the container as follows docker run -i -t -p 8080:3000 node-express The node app in the container is running with pm2, so it continues once I exit out of the container. CONTAINER ID IMAGE f32de2737e80 node-express:latest Now assume I […]

Node.js Swagger generate UI doc JSON feed

I’m using Node.js and Swagger to build a restful API. The Swagger UI (demo link here http://petstore.swagger.io/) requires a JSON feed. How would you generate this feed based on the Swagger spec yaml file? Is there not a npm module that can iterate over the yaml file and generate the JSON feed? I’m new to […]

gcloud pubsub – how to create watch request

I’ve created a topic, subscribed to it, set publishing rights of the topic using Google’s API Explorer and now need to create a watch request, as described here: https://developers.google.com/gmail/api/guides/push However, according to previous threads, you cannot do this with API Explorer and must do it directly from gcloud. I know the general form of the […]

Using Sequelize with Redshift

Is it possible to use Sequelize with Redshift? If not, what are the alternatives? I need an ORM for Node.js with built-in support for transactions, hence Sails.js is not an option. I’ve also looked at Bookshelf, but could not find any support for Redshift either.

Error: Cannot find module 'ms'

I’ve been trying to get my app running for a few days now, but keep getting errors. I’m closer than I have been so far, but am now getting the “Cannot find module error” when trying to launch my application. Below is the error I’m getting now. C:\MY-APP\dataService>node dataAPI.js module.js:338 throw err; ^ Error: Cannot […]

How can I set NODE_ENV permanently with ansible?

I have 2 machines for my two environments. The first one hosts a staging environment. It needs to have NODE_ENV set to dev. The second one hosts a production environment. It needs to have NODE_ENV set to prod. I provision my servers with Ansible. How can I do this ?

Braintree customer.find() not working using Nodejs

I’m using Braintree nodejs Sdk for one of my project, I have problem to use customer.find() function. origina link is here when I passed a user id like ‘207’ directly in this way, it’s working. var braintree = require(“braintree”); var gateway = require(“./bt”); gateway.customer.find(‘207’, function(err, customer) { console.log(“customer:”,customer); }); but when I tried to pass […]

Is it possible to have redirection follow a rendering in express + node js?

I have use case where there needs to be rendering followed by redirection. Rendering is supposed to inform user about successful transaction using inherit view model followed by redirection to home page. Following is desired code: router.post(‘/posturi’, function(req, res, next) { //Call few services if(err){ return res.render(‘/errorpage’) } res.render(‘/transaction page’); //TimeOut function goes here res.redirect(‘/home’); […]

Loopback-component-storage: How to convert image to thumbnail before uploading to Amazon S3

I am using loopback component storage for uploading image to server. I want to convert each image that been uploaded through server to a thumbnail view and save it to the container. Initially I was using local file storage to store file and everything was working fine. In file storage I was using “quickthumb” for […]

Populating filename in Save As window when using Electron Dialog module and .showSaveDialog

When using the Dialog module in Electron and .showSaveDialog() to save a file, is there a way to make the filename in the Save As window populate with the actual filename?

Node.js is the Best Javascript runtime in the world.