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
0 answers

How do you define both a single id and multiple ids with swagger?

We have the following end point defined in swagger products/{ids} where ids is a list of comma separated ids. However, we get an error if there is only one id. For example products/4 gives an error whereas products/4,5 is ok and even products/4, is…
Martimatix
  • 1,553
  • 1
  • 15
  • 18
0
votes
1 answer

Handling of conditionally unconsumed http.IncomingMessage

I want to forward an upstream http.IncomingMessage to a client via a restify server. This is what I came up till now. It provides the forwarding capability. However I assume that this could cause a memory leak: var server =…
Andreas Wenger
  • 4,310
  • 1
  • 22
  • 31
0
votes
1 answer

Can I return my own custom token base authentication in node js

I am using node-js restify. While signing a user up server.head('/signup', function (req, res, next) I generate a custom token. token = *** res.set('token', token); res.send(); I am trying to send the token back but I can't find any documentation…
andre
  • 7,018
  • 4
  • 43
  • 75
0
votes
1 answer

Serve static files with or without extension in restify

I need serve both http://localhost/users/list and http://localhost/users/list.html server.get(/.*/, restify.serveStatic({ directory: './public', })); This code only works if you specify the .html extension.
Almis
  • 3,684
  • 2
  • 28
  • 58
0
votes
1 answer

Can i set socket timeout and read timeout in node.js request module?

I use node.js(restify) and request module(https://www.npmjs.com/package/request). My node server is proxy and request to other server. I want to set socket timeout and read timeout each. like clientSocket.connect / clientSocket.setSoTimeOut in…
0
votes
1 answer

Multiple functions in restify function to elasticsearch client

I'm building a REST API using node and restify that communicaties with an elasticsearch database. Now when I delete an object, I want this to do a kind of cascading delete to some other objects. I know this is not really what to use elasticsearch…
Matthias
  • 330
  • 3
  • 7
  • 20
0
votes
1 answer

handling net socket response on restify js

I'm writing a middleware in nodeJs with restify, but I can't handle the async response from the server: the following code is called here in my index.js: app.get('/get-users', [getUsers]); ... function getUsers(req, res) { var query =…
0
votes
1 answer

Restify: "override" default next

I want to kinda override default next in Restify. E.g. now i have code like server.post('/names', function (req, res, next) { names = req.params.names; if (!Array.isArray(names)) { return next(new restify.errors.BadRequestError('names field…
Ximik
  • 2,435
  • 3
  • 27
  • 53
0
votes
1 answer

restify jsonClient failing at post

createJsonClient to post my data to a restify server like console.log(typeof payload); // string payload = JSON.parse(payload).Body; console.log(payload); //object client.post('/sqs', payload, function (err, req, res, obj) { if (err) …
Kenichi Shibata
  • 148
  • 2
  • 11
0
votes
1 answer

Cannot upgrade restify to latest 5.x

I am currently using restify version 4.0.3 I run this command; $ ncu -u I can see other npm packages being upgraded but not restify. I would like to upgrade restify to the latest 5.x. How can this be done? Any compatibility problems when upgrading…
guagay_wk
  • 26,337
  • 54
  • 186
  • 295
0
votes
1 answer

What should a proper http post response be in restify?

I am using node.js restify. I have a HTTP Post handler that looks something like this; var api_post_records = function (app, url_path) { function post_handler(req, res, next) { //code runs here res.send("ok"); //have to run some response…
guagay_wk
  • 26,337
  • 54
  • 186
  • 295
0
votes
1 answer

How to run multitple Node apps on the same port using Restify?

I need to run multiple Node apps on the same port. I've found out that I can run multiple node apps using one port, thanks to this SO question Running multiple Node (Express) apps on same port But it's not working for me probably bec. I'm using…
junerockwell
  • 838
  • 1
  • 9
  • 29
0
votes
1 answer

Unexpected EOF on graphql POST request

I am using the fetch api to make a POST request sending a GraphQL fetch( dbUrl, { method : 'post', body : JSON.stringify( { graphql : "mutation M {saveUser(name:'Avraam')}" } ) } ) On the request body I can…
Avraam Mavridis
  • 8,698
  • 19
  • 79
  • 133
0
votes
1 answer

Defer all requests until database is connected

My Restify server is dependent on a database connection which is established through an asynchronous function and a callback. I'm hosting it on Azure, where the server turns off after a period of inactivity, but when it wakes up, it restarts…
Reubend
  • 644
  • 1
  • 6
  • 19
0
votes
1 answer

Connection between restify web service with express app

I am new to programming and I need to create a restful web service using Restify but the entire application is build on Express.js . How to connect between the web service and the app?
Murgin Boo
  • 67
  • 1
  • 10