Skip to content
Advertisement

Tag: node.js

Rest with Express.js nested router

Suppose I want to have REST endpoints which look roughly like this: CRUD on each if makes sense. For example, /user POST creates a new user, GET fetches all users. /user/user_id GET fetches just that one user. Items are user specific so I put them under user_id, which is a particular user. Now to make Express routing modular I made

How to read and save attachments using node-imap

I’m using node-imap and I can’t find a straightforward code example of how to save attachments from emails fetched using node-imap to disk using fs. I’ve read the documentation a couple of times. It appears to me I should do another fetch with a reference to the specific part of a message being the attachment. I started of with the

Socket.io error hooking into express.js

I’m trying to hook socket.io and express.js together: At the line: var io = require(‘socket.io’).listen(app); I’m getting an error: There doesn’t seem to be anything on SO/google about this error… Answer You can do it without using http module app.listen return a server instance you can use for socket.io

How to set cell width when export .xlsx files with js-xlsx

I am trying to set a fixed column/cell width to my exported excel files with js-xlsx. EDIT: Here is the source of js-xlsx: https://github.com/SheetJS/js-xlsx Answer I found a snippet the the write test here https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19 For quick reference, where ws is your worksheet.

What’s the proper way to document callbacks with jsdoc?

I’ve spent quite a while scouring the internet looking for the best way to properly document callbacks with jsdoc, but unfortunately, I haven’t found a great one yet. Here’s my question: I’m writing a Node.js library for developers. This library provides multiple classes, functions, and methods that developers will be working with. In order to make my code clear and

Socket.io not sending cookies in the handshake causing the request to stall

Let me explain my setup. I have multiple domain names that are all CNAME records for a main domain name, such as example.com. example.com -> serverIP company1.example.com -> example.com company2.example.com -> example.com I’m basically developing white labeled versions of our software, where the software simply detects the referrer and knows which logos and stylesheet assets to load. So that is

Express Node.js doesn’t work

I installed express 4 along with node.js,npm and express-generator on my ubuntu 12.04 and created an app using the following commands: Now what I should get is “Express server running on port 3000” but instead the command simply executes and doesn’t leave any message or error. So I have no idea of which port express is running on or whether

Advertisement