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
9
votes
2 answers

location object expected, location array not in correct format

I have spent doing such a straight forward thing. I just want to do a CRUD operation on a user model using nodejs, mongoose, restify stack. My mongo instance is on mongolab. The user should contain a "loc" field . User schema is as follows : var…
shaun
  • 185
  • 3
  • 12
9
votes
2 answers

Restify and Angular CORS No 'Access-Control-Allow-Origin' header is present on the requested resource

I faced with that problem when implementing REST api with Restify secured with bearer token authorization type. when I sending simple get request to API server it fails with CORS problem 405 (Method Not Allowed) angular.js:7962 OPTIONS…
Ph0en1x
  • 9,943
  • 8
  • 48
  • 97
9
votes
5 answers

node js using express and restify together in one app

I am using restify building apis, it works great. But I need to render some web pages as well in the same application. Is it possible I can use express and restify together in one application? this is the code for restify server in app.js var…
wwli
  • 2,623
  • 6
  • 30
  • 45
9
votes
2 answers

Node.js + Serve Static Files with RESTIFY

I have a multi-level collection of .html, .js, .png, .css, etc files in a site. A peek at my site hiearchy looks like the following: index.html child1 index.html page1.html page2.html ... child2 grandchild1 index.html grandchild2 …
user2871401
  • 1,867
  • 5
  • 22
  • 24
8
votes
2 answers

Combine output of 2 queries in REST API

I am using node.js restify module. I have a REST API which outputs the result of a single MySQL query in json. Here is the code of the API; var rest_api_get_list = function (app, url_name) { function respond(req, res, next) { var…
user6064424
8
votes
2 answers

Restify: API version in URL

Currently under development of API with restify and still cannot get used to specifying the API version in headers. It just doesn't seem very user friendly. Is there any way for version to be part of url? Example would…
Tomas
  • 2,676
  • 5
  • 41
  • 51
8
votes
1 answer

throttle per url in node.js restify

The documentation states: Note that you can always place this on per-URL routes to enable different request rates to different resources (if for example, one route, like /my/slow/database is much easier to overwhlem than …
ilovett
  • 3,240
  • 33
  • 39
8
votes
3 answers

Node.js, restify and proper routing

I'm still wrapping my head around Node, but I have a very simple question. I see a lot of node examples where people are declaring their routes and all their logic in a single app.js file (or sometimes splitting them off into subfiles). My question…
pilotguy
  • 543
  • 1
  • 5
  • 18
7
votes
2 answers

Node Js - Identify if the request is coming from mobile or non-mobile device

I'm still new with node js. Is there any workaround or methods on how to identify the request from client-side is from mobile or non-mobile devices using node js? Because what i'm doing now is i want to restrict the access on certain API based on…
DMDJ
  • 357
  • 1
  • 6
  • 13
7
votes
2 answers

CORS-enabled server not denying requests

I am trying to use express Cors with my resitfy server and it doesn't seem to be denying requests coming from other ips. I am working locally so I tried setting origin to a random public ip but all of my requests are still going through Here is my…
Sam Munroe
  • 1,266
  • 2
  • 20
  • 41
7
votes
1 answer

restify.serveStatic is not a function error

I am using following script but this script is throwing error that serveStatic is not a function I have installed restify using this command "npm install --save restify" var restify = require('restify'); var builder = require('botbuilder'); var…
Tushar
  • 167
  • 12
7
votes
2 answers

Get restify REST API server to support both HTTPS and HTTP

I am using node.js restify ver4.0.3 The simple following code works as a simple REST API server that supports HTTP. An example API call is http://127.0.0.1:9898/echo/message var restify = require('restify'); var server = restify.createServer({ …
guagay_wk
  • 26,337
  • 54
  • 186
  • 295
7
votes
1 answer

How to make synchronous call with mongoose and nodejs

I'm designing a client/server synchronization feature. The client sends a bunch of changed events to server. The server will do creation, deletion or modification upon requested item status. After the database operation, the server need send a…
duckegg
  • 1,379
  • 2
  • 13
  • 20
7
votes
4 answers

JavaScript leaking memory (Node.js/Restify/MongoDB)

Update 4: By instantiating the restify client (see controllers/messages.js) outside of the function and calling global.gc() after every request it seems the memory growth rate has been reduced a lot (~500KB per 10secs). Yet, the memory usage is…
ndsc
  • 1,173
  • 2
  • 13
  • 22
7
votes
1 answer

Testing CORS with cURL

I've been implementing CORS in a lil app I have using node-restify to test it out and it turns out that in the browser, the behaviour is as expected, this means, in a different origin with CORS disabled, it doesn't work, if CORS is enabled, it…
David Dias
  • 1,792
  • 3
  • 16
  • 28
1 2
3
41 42