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

cant return a value outside the query. mongoose

i'm new to node js, i'm using restify and mongoose. so, i try to return some value when i found the data and return null when data not found. here is my code: getUsers = function (user, pass, urole){ var data = ''; …
lutfi
  • 65
  • 2
  • 8
0
votes
1 answer

Ensure data integrity with nodejs, restify and mongoose

I'm writing an analytics application that collects events and associates it with visitors. My Visitor mongoose model as follows: var visitorSchema = new Schema({ created_at: { type: Date, default: Date.now }, identifier: Number, …
Guilherme Viebig
  • 6,901
  • 3
  • 28
  • 30
0
votes
1 answer

Openshift - auth: couldn't find user while connecting mongodb via mongojs

I am following this tutorial to host a Rest API at my openshift account: Day 27: Restify–Build Correct REST Web Services in Node.js As per my requirements I made few changes, below is the code: server.js var restify = require('restify'); var mongojs…
Devarshi
  • 16,440
  • 13
  • 72
  • 125
0
votes
0 answers

Restify refusing POST/PUT requests after 10 requests

I've built a small API using Restify and Node.js. I have a PHP application sending cURL requests, but after five PUT or POST requests (10 when using CLI), the Node.js server starts refusing PUT and POST requests (but not GET requests, and I haven't…
Dubstaphone
  • 400
  • 3
  • 16
0
votes
1 answer

MapperParsingException when logging requests with bunyan/logstash/elasticsearch

We are logging Restify requests in ElasticSearch using Logstash and Bunyan. However, when including the JSON body in logging the index gets conflicts because fields with the same name sometimes have different types. One example is when req.body is…
Anders Bornholm
  • 1,326
  • 7
  • 18
0
votes
1 answer

Restify req.getLogger is not a function

How do I install bunyan logger so that on the routes they can get children of bunyan for their own loggers? Attempt: import * as restify from 'restify'; import {createLogger} from 'bunyan'; let app =…
A T
  • 13,008
  • 21
  • 97
  • 158
0
votes
1 answer

How to host 2 AngularJS app in 1 instance of Heroku?

I have an API coded in Nodejs and an AngularJS app statically served by the same server. I need to host another AngularJS app which should be served by the same server. How can I do that? Can Restify or Express serve 2 static apps? I used…
Burak
  • 5,706
  • 20
  • 70
  • 110
0
votes
1 answer

Setting restify default JSON response

I am trying to pipe a file's content using a readStream that writes to restify's response. But I am not able to set the global response Content-Type header Here is what my code looks like let restify = require('restify'); let router =…
Subtubes
  • 15,851
  • 22
  • 70
  • 105
0
votes
2 answers

POSTing RAW body with restify client

I'm trying to POST a raw body with restify. I have the receive side correct, when using POSTman I can send a raw zip file, and the file is correctly created on the server's file system. However, I'm struggling to write my test in mocha. Here is…
tnine
  • 156
  • 9
0
votes
1 answer

Restify: Calling a middleware within a middleware

I have a middleware for authentication which decrypts the token in the header and put the userId from the token to req.userId. Otherwise it throws an error if token doesn't exists or is invalid. I call it like this in routes where I need…
Ali Yousuf
  • 692
  • 8
  • 23
0
votes
1 answer

Can node-restify paths work with swagger?

The node-restify library allows paths like /foo/:id. Can swagger handle such paths? i.e. something like? var getFoo = { 'spec': { 'description': 'foo library', 'path': '/foo/:id', 'summary': 'return foo by id', …
Prachi
  • 528
  • 8
  • 31
0
votes
2 answers

restify route path meaning

I have the code below, and the path is really confusing. The api guide of restify do not explain much. const restify = require('restify'); const app = restify.createServer(); app.get(/\/path\/.*/, function(req,res,next){ …
agsonoo
  • 25
  • 5
0
votes
1 answer

JWT Restify exclude Path and all Subpaths

At the moment i use the Node Module jwtRestify for authentication. And i have one problem, i would like exclude some paths from the authentication which is no problem with: server.use(jwtRestify({ secret: config.secret, requestProperty:…
Sprotte
  • 541
  • 6
  • 19
0
votes
1 answer

How do I get firefox to complete a download sent from restify? (nodejs)

I have an HTTP endpoint that delivers a file in the response to a request. My intent is for it to be downloaded by the browser, so I am setting the Content-Type to application/octet-stream and the Content-Disposition is set to Attachment;…
Ryan
  • 4,179
  • 6
  • 30
  • 31
0
votes
1 answer

Memory usage of assigned variables in node (with restify)

setInterval(() => { var mem = process.memoryUsage(); console.info("Memory used: ", mem.heapUsed.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ")); }, 1000); server.get("/", function(req, res, next) { var test = new Array(1e7); test…
henit
  • 1,150
  • 1
  • 12
  • 28