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

restify example TODO server not sending responses

I'm new at this and developing my first API server. I wanted to see an example of a POST request so I installed restify 3.0.3 and tried to run the TODO server example. I see the requests logged at the server but no response is sent. I'm using the…
daveo
  • 3
  • 2
0
votes
0 answers

OPTIONS method not allowed when asking for OAuth2 token

I've got a simple node.js backend build on Restify with OAuth2 authorization implemented (restify-oauth2 plugin). I've got a problem requesting a token. When I call POST method with my REST client, everything works correctly and I get access_token…
zorza
  • 2,814
  • 3
  • 27
  • 41
0
votes
0 answers

Using test spy to record REST requests and reponse

I am trying to use sinon.spy to record calls beforeEach: // Get restify JSON clinet instance // Using rewire // m_jsonClient is a private field m_jsonClient = myMod.__get__('m_jsonClient') jsonClientGetSpy = sandbox.spy(m_jsonClient, 'get') it: …
hellboy
  • 1,567
  • 6
  • 21
  • 54
0
votes
1 answer

Where to put return next() properly in Restify module in node.js?

Here is an example for querying user from database then if user exists, another query for phone: module.exports = function (username, req, res, next) { var query = User.where('username', new RegExp('^' + username + '$', 'i')); …
Maher Abuthraa
  • 17,493
  • 11
  • 81
  • 103
0
votes
3 answers

Which will be better for API creation - RESTify or KOA.js

I am trying to create a REST service for an iOS application. I am debating to which framework should I use (as I am also a bit new to Node.js). I started by considering the following - Express, HAPI, RESTify, KOA.js (using KOALA maybe?) and ended up…
dinbrca
  • 1,101
  • 1
  • 14
  • 30
0
votes
1 answer

How to access save session data

I'm using Restify module to create REST server and using Restify-session module to save user credentials. However, I cannot seem to retrieve save session data. My request object does not have session data I saved earlier. I tried 'load' method of…
KMC
  • 1,677
  • 3
  • 26
  • 55
0
votes
1 answer

Node.js Restify send response when value changed

I have a nodejs+restify server set up. It is used for an online ordering api that accepts online orders from different vendors and forwards them down to the relevant store and pos terminal. This is working fine for most of the vendors. I am having a…
0
votes
1 answer

NodeJS Buffer Base64 File Limits

Tried to upload an image using Base64 but if the string is long the bottom of the stored image is blank white. upload.js var uuid = require('node-uuid'); var fs = require('fs'); exports.uploadImage = function(base64Str, callback) { var filename…
Mark Tyers
  • 2,961
  • 4
  • 29
  • 52
0
votes
1 answer

Serving images based on :foo in URL

I'm trying to limit data usage when serving images to ensure the user isn't loading bloated pages on mobile while still maintaining the ability to serve larger images on desktop. I was looking at Twitter and noticed they append :large to the end of…
ShadyLink
  • 3
  • 3
0
votes
0 answers

routing using nodejs restify

I created below sample server.js and in this I want server to load default index.html at http:localhost:3000/public but it is loading route "/products/?query" at above path, please let me know where i am wrong in implementing. var restify =…
user3231742
  • 77
  • 1
  • 2
  • 10
0
votes
2 answers

Simplify query checks in Node.js+mongoose

I'm writing a really simple RESTful API using Node.js, restify and mongoose but the code is getting complex and long. This is caused by all the checks that I have to do every time I make a query. For example, the next code show the controller for…
David Moreno García
  • 4,423
  • 8
  • 49
  • 82
0
votes
1 answer

How to delete all/some restify routes and add new

I have a JSON config file which specifies API end-points. I read it on app load and iterate through its keys, like this server[type](config.path, function (req, res, next) { }); Now, I am looking for a way to remove that route from server. I mean…
Salman
  • 9,299
  • 6
  • 40
  • 73
0
votes
0 answers

NodeJS with Restify: One of the modules is not working

I am creating a RESTful API using NodeJS and Restify. I have the following folder structure: main.js modules ./modules: continents countries ./modules/continents: controller.js model.js ./modules/countries: controller.js …
user730009
  • 313
  • 1
  • 5
  • 18
0
votes
1 answer

Why is my stream error handler not being called?

I have the following restify handler: var assert = require('assert-plus'); var request = require('request'); function postParseVideo(req, res, next) { assert.string(req.body.videoSourceUrl, 'videoSourceUrl'); var stream = request.get({uri:…
Jason Whittle
  • 751
  • 4
  • 23
0
votes
1 answer

How to return value from a series of cascading async code

I need some advice on how to re/write the db specific cascading code (callback) so that I can effectively return a value to the underlying if/else. I am using restify and the db lib is node-mssql (tedious). function authenticate(req, res, next) { …
schliden
  • 13
  • 3