Questions tagged [restify]

restify is a module for use with node.js that facilitates the creation of REST web services.

resitfy enables developers to create a REST web services API on top of . restify borrows from the web application framework.

622 questions
0
votes
1 answer

node.js, async, restify: cannot make restify call synchronous inside async.series

I am trying to enforce a few asynchronous functions in node.js, to execute synchronously. I am using async.series for that. Here's my code: async.series([ function(callback){ fs.truncateSync('rooms.txt', 0); …
kajarigd
  • 1,299
  • 3
  • 28
  • 46
0
votes
1 answer

Node Restify not responding to consecutive requests to the same endpoint

I've been playing around with restify and came across a behaviour which I'm having an hard time understanding. My code is as follows: var restify = require('restify'); var logger = require('log4js').getLogger('index.js'); var server =…
jribeiro
  • 3,387
  • 8
  • 43
  • 70
0
votes
1 answer

PUT request in Restify API, NodeJS, MongoDB

I am trying to write a PUT request for my API. I'm using restify to build the API. I keep getting the errors, could you please help? //PUT (Update) Items app.put('/items/:item_id', function(req, res){ var query = Item.where({_id:…
Kokoliko
  • 1
  • 2
0
votes
1 answer

How to test function returning next method with Hippie?

I've got a function which returns next(); as a function to allow next route to be called and it's used for checking the token as an interceptor and allows function to go through. The problem I have now is that I want to test this particular function…
Passionate Engineer
  • 10,034
  • 26
  • 96
  • 168
0
votes
1 answer

Connect to couchDB through Restify

I have been trying to connect to couchDB to get some data back or do anything with it. I have not been able to connect to couchDB! Please can anyone tell what am I doing wrong. Please!!! When run this program it console logs "incoming requests" &…
Skywalker
  • 4,984
  • 16
  • 57
  • 122
0
votes
2 answers

can't set headers after they are sent node js when using restify module

I have used tedious to connect to sql server and restify for restful api here is the server.js server.get('/getInvoiceData', function (req, res, next) { repository.GetInvoiceData(function(data){ res.send(data); next(); …
Prateek Dhuper
  • 235
  • 4
  • 14
0
votes
2 answers

Default condition not working in Node

I have below code: var port = request.app.settings.port || 3000; This throws an error: TypeError: Cannot read property 'settings' of undefined at forceLogin (/home/projects/nodejs/node_modules/connect-keycloak/middleware/protect.js:5:25) at…
Passionate Engineer
  • 10,034
  • 26
  • 96
  • 168
0
votes
1 answer

How to use prototype with require?

I have below code that I want to import in Node modules: Kc.prototype.middleware = function(options) { options.logout = options.logout || '/logout'; options.admin = options.admin || '/'; var middlewares = []; middlewares.push( Setup ); …
Passionate Engineer
  • 10,034
  • 26
  • 96
  • 168
0
votes
2 answers

Windows Azure and restify with node js

I have an azure website which has a URL of something like : http://app.azurewebsites.net/. Now I have my server.js file that contains the following code: var restify = require('restify'); function respond(req, res, next) { res.send('hello ' +…
tsure
  • 315
  • 3
  • 6
  • 16
0
votes
2 answers

Piping a readstream into a writestream does not work

I (as the client) am trying to post an image with restify, and the server just needs to save it. req.pipe(fs.createWriteStream('test.jpg')); is not working. An empty file is created but nothing more. It works when I copy req.body into a buffer and…
sil0r
  • 51
  • 1
  • 1
  • 2
0
votes
2 answers

using middlewares for specific namespaces in restify

I would like to use a middleware for checking users credentials only for some routes (those that start with /user/), but to my surprise server.use does not take a route as first argument and with restify-namespace server.use effect is still…
fortran
  • 74,053
  • 25
  • 135
  • 175
0
votes
1 answer

maxBodySize does not work restify

I have a node app running v0.10.33 with Restify module ^2.8.3 var app = restify.createServer(); app.use(restify.queryParser()); app.use(restify.bodyParser({ maxBodySize: 1, //TODO: This limit is not working at the moment. uploadDir: './temp', …
Mat Zero
  • 386
  • 3
  • 9
0
votes
1 answer

How To Set Up A Ping Route (HEAD) For New Relic In Restify/Express

I need to monitor my application's uptime via New Relic. I'm using the Restify framework which is largely based on Express. New Relic wants to make HEAD requests to my application, but I'm not sure how to set up a HEAD route correctly to satisfy…
ac360
  • 7,735
  • 13
  • 52
  • 91
0
votes
1 answer

restify + use() method - never call

I try use "use()" method of Restify like that: ... server = Restify.createServer(@options) server.use(Restify.queryParser()) server.use(Restify.urlEncodedBodyParser()) server.use(Restify.CORS()) server.use( (req, res,…
0
votes
1 answer

Key-value-like store for most specific URI

Is there a data-structure/model for storing a value at an arbitrary URI-based key, and then if null, backing down to a less specific path/domain? i.e. SET example.com "hello" SET a.example.com/foo "world" GET example.com => "hello" GET…