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
175
votes
18 answers

mongoError: Topology was destroyed

I have a REST service built in node.js with Restify and Mongoose and a mongoDB with a collection with about 30.000 regular sized documents. I have my node service running through pmx and pm2. Yesterday, suddenly, node started crapping out errors…
dreagan
  • 2,426
  • 6
  • 24
  • 34
157
votes
3 answers

passport.js RESTful auth

How does one handle authentication (local and Facebook, for example) using passport.js, through a RESTful API instead of through a web interface? Specific concerns are handling the passing of data from callbacks to a RESTful response (JSON) vs using…
ryanrhee
  • 2,550
  • 4
  • 23
  • 25
104
votes
6 answers

Why should I use Restify?

I had the requirement to build up a REST API in node.js and was looking for a more light-weight framework than express.js which probably avoids the unwanted features and would act like a custom-built framework for building REST APIs. Restify from…
Mithun Satheesh
  • 27,240
  • 14
  • 77
  • 101
82
votes
11 answers

Error: getaddrinfo ENOTFOUND in nodejs for get call

I am running a web server on node the code for which is given below var restify = require('restify'); var server = restify.createServer(); var quotes = [ { author : 'Audrey Hepburn', text : "Nothing is impossible, the word itself says 'I'm…
nnm
  • 1,335
  • 5
  • 18
  • 32
60
votes
4 answers

Difference between response.send and response.write in node js

I have written a small API which uses the Node js "restify" framework. This API receives a request (actually anything after "/") and then send that request to another server. Get the response back from server and passes the response back to original…
user3275959
  • 611
  • 1
  • 5
  • 4
47
votes
14 answers

How can I support cors when using restify

I have a REST api created with the restify module and I want to allow cross-origin resource sharing. What is the best way to do it?
Kim
  • 4,593
  • 5
  • 21
  • 18
38
votes
2 answers

What's the best practice for MongoDB connections on Node.js?

This is something that is a bit unclear to me (I'm just getting started with Node and Mongo), and it really concerns me because of server performance and strain (which I guess is another question, but I'll get to that at the end of the post). So,…
arturovm
  • 1,215
  • 2
  • 12
  • 28
33
votes
7 answers

Serving static files with restify

I am learning to use Node.js. Currently, I have a folder structure that looks like the following: index.html server.js client index.html subs index.html page.html res css style.css img profile.png js page.js …
Node Newbie
  • 1,951
  • 5
  • 17
  • 14
29
votes
3 answers

How to parse/read multiple parameters with restify framework for Node.JS

Scenario: We developer are trying to replace a web service (written in C#.Net) with Node.JS Restful API. Issue: Now we need to handle the incoming request as is (we don't have control over it). So the following is the format of the incoming…
24
votes
3 answers

serving static files with restify (node.js)

I have the following code: app.js [...] server.get(/\/docs\/public\/?.*/, restify.serveStatic({ directory: './public' })); server.listen(1337, function() { console.log('%s listening at %s', server.name, server.url); }); And I have the…
opensas
  • 60,462
  • 79
  • 252
  • 386
21
votes
4 answers

how do you send html with restify

I want to send plain html instead of a json response for one of my routes in restify. I tried setting the contentType and header property of the response but it doesn't seem to set the contentType in the header (the browser tries to download the…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
19
votes
9 answers

Application 'appname' failed to start (port 8080 not available) on open shift node app

I have written a node restify server in coffee and I can't seem to get it running. While deploying I get the following error: Waiting for application port (8080) become available ... after which I do get the following error Application 'appname'…
philip_nunoo
  • 920
  • 3
  • 10
  • 21
19
votes
1 answer

Creating an OAuth2.0 service provider using RESTify Node.js

I have a restful API that I built using node.js and node-restify. I am up to the part where I have to secure it. Apparently, it is easy to find out how to use OAuth 2.0 as a client but hard to find out how to set up a provider. I guess my google…
whattupyo
  • 373
  • 2
  • 10
18
votes
5 answers

I need to replace Bearer from the header to verify the Token

bearer = bearerHeader.replace("Bearer",""); jwt.verify(bearer, 'super_secret', function (err, decoded) { console.log(err); console.log(decoded); }); Here is my code. Whenever I try to verify Token. I want to replace Bearer from header to…
Nainesh Raval
  • 211
  • 1
  • 3
  • 10
17
votes
2 answers

How to avoid fast memory increase during scavenge gc?

I have an application built on restify. I have no memory leaks, however I have big memory growth during scavenge gc, then comes heavy weight mark-sweep gc and cleans the memory. It affects performance of my application. [2268] 266859 ms: Scavenge…
Vlad Miller
  • 2,255
  • 1
  • 20
  • 38
1
2 3
41 42