Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Robert Lindstädt
@eljefedelrodeodeljefe
hmm. now scrolling up there could be an answer(?) :)
Robert Lindstädt
@eljefedelrodeodeljefe

using supertest.agent( ... ) is the workaround.

Can I suggest a testing guide and or providing an .end() method. Will send PRs for both soon, if wanted.

Corey Beaumont
@coreybeaumont
@eljefedelrodeodeljefe I’d be intereted to see how you’ve set up supertest and tape. I ran into issues and moved to using jasmine and request
Matt Forster
@forstermatth
@eljefedelrodeodeljefe @CoreySwish I've been using vesln/hippie to test restify instances with good results (no hangs) - example. @eljefedelrodeodeljefe: there is a .close() method available on the server object, docs here, under Other Methods
Matt Forster
@forstermatth
@eljefedelrodeodeljefe i see that your looking for something to end the request for tests, not the server instance. ignore that second part
Corey Beaumont
@coreybeaumont
Thanks @forstermatth, Have you used jasmine? If so, how do you think it compares?
Robert Lindstädt
@eljefedelrodeodeljefe

@forstermatth exactly. I ended up using supertests.agent() method, which doesn't pull the whole server instance into your test. You must end the server after your tests then though.

@CoreySwish I reckon this is feasible. I will end up doing something like this for more complex queries:

var test = require('tape')
var supertest = require('supertest');
var server = supertest.agent("http://localhost:8080");

test('Proximity API test', function(t) {
  t.plan(1)
  function proximityTest(latAndLong,cb) {
    server
    .post('/users/positions')
    .send({
      lat_and_long: latAndLong
    })
    .expect(200)
    .end(function(err,res){
      if (err) {
        return t.fail('Route does not reply correctly')
      }
      return cb()
    })
  }
  proximityTest([52.487395, 13.394405], function() {
    proximityTest([52.488258, 13.394448], function() {
      proximityTest([52.489029, 13.394501], function() {
        t.pass('Request came through as expected')
      })
    })
  })
})

Unfortunately you can't chain supertest, but it looks okay an node-y to me.

Corey Beaumont
@coreybeaumont
@eljefedelrodeodeljefe thanks for the insight, i was getting really annoyed with the test not completing fully
Matt Forster
@forstermatth
@CoreySwish I'm running the tests using mocha, in the end they are all the same to me, just test runners.
Corey Beaumont
@coreybeaumont
How do you guys handle caching? Do you do this at the app level? At the gateway level? I’m looking at reddis vis aws elastiCache. Just looking for some ideas of implementations
Tim Branyen
@tbranyen
@CoreySwish I'm currently dealing with that myself
Hooked in falcor to restify, but after messing with its router, way overkill. I'm looking at writing a basic memoizer with cache invalidation now
Corey Beaumont
@coreybeaumont
ah I see. are you using a gateway to access the api or are your consumers hitting the restifyapp directly? I’m tyring to figure out if I implement at our gateway level (KONG) or at the restify level. I’m also just planning right now I’m averaging 100 calls per second per apache bench.
Tim Branyen
@tbranyen
Well I'm trying to get an "isomorphic" universal app thing going, so I'll be hitting restify directly
We've abstracted "routes" and "requesters" so I may just integrate that in my requester layer
avimar
@avimar
The docs mention httpsRedirector in the timers... is this available anywhere? I assume it auto-redirects from port 80 to 443 if necessary..?
Google didn't find anything...
avimar
@avimar
Figured I'd share my final http/https code for anyone else interested. https://gist.github.com/avimar/73036af0a85982f88625, Feel free to steal it, I added an "unlicense".
Yannick Grenzinger
@ygrenzinger
Hello everybody !
Hope you can give me some hints. I have a ECONNRESET popping up from somewhere and that make NodeJS crash and restarted by PM2 :/
I have tried to find it in some Restify Client call with client.on('error', ...) and I have a server.on('uncaughtException', ...)
but at this point no more hints what is the cause :/ Longjohn module for long stacktrace doesn't help a lot
Error: read ECONNRESET
at exports._errnoException (util.js:874:11)
at TCP.onread (net.js:544:26)
at fireErrorCallbacks (net.js:444:15)
at Socket._destroy (net.js:480:3)
at TCP.onread (net.js:544:17)
Alexander Alimovs
@aalimovs
@ygrenzinger, sorted?
Yannick Grenzinger
@ygrenzinger
hello @aalimovs I have sorted it by setting agent to false in restify JSON client. The other service doesn't like I try to maintain a connection.
finally same issue and fallback as discussed there restify/node-restify#485
So the problem is "resolved" but some questions remains ... is setting agent to false a not so bad things ? why client.error() doesn't catch anything ?
the last question is maybe the most worrying one
thanks a lot :)
Guilherme Viebig
@viebig
hello all
is queryParser broke?
Paul Rumkin
@rumkin
This message was deleted
Pedro Montoto García
@McOmghall
Hello everyone, is there a simple way to add different verbs to the same named route? like
restify.get({name: 'name', path: 'path'}, /.../).post(/etc/)
Also, any way to make hierarchical routes (i.e. handlers for routes inside routes)
Cristian Lupu
@Khez
I noticed there are a lot of packages to create restify swagger docs, any recommendations ?
Cristian Lupu
@Khez
your silence says it all… I should roll my own… /not :shipit:
avimar
@avimar
@Khez I don't see much activity here, so no answer doesn't mean very much.
If you come across a nice doc'ing package that plugs into restify, please give me a shout.
Cristian Lupu
@Khez
@avimar there are actually quite a lot, but each have particularities that are not as plug and play as I want them to be
Finn
@nguyennb9
blob
I see the dependencies are out of date. Are there any problem with it?
nodecraic
@webworkio
hey, if anyone has any remote remote , designer, DevOps or Sysadmin jobs they can post them at http://webwork.io
Fagner Brack
@FagnerMartinsBrack
What are the node versions supported by restify (latest 4.0.4)?
Saleem
@zalym
hello, I am having an issue where too many connections are being opened and closed. How do I control the number of connections? Ideally I would like to have one connection to the server and then stream all requests through that connection
Victor Augusto
@augustovictor

Hello everyone.

I am looking for a someone's project to take a look at then I can follow the same project structure and patterns.

Thanks

Victor Augusto
@augustovictor
What's the best way to do something like this?
var mid = function(req, res, next) {
  models.Team.find({
      where: {
        id: req.params.id
      }
    }).then(team => {
      if (team) {
        req.team = team;
        return next();
      } else {
        res.send(404, 'Team not found');
      }
    }).catch(err => {
      send(500, err);
    });
};


// -----------------------------------------------

var getById = function(req, res, next) {
  mid(req, res, next);
  res.send(req.team);
  return next();
};
Maciej Ziehlke
@digitalmio
Hey all. Can you please advise me best oAuth2 server implementation (with SCOPES) for Express / Restify?
Yannick Grenzinger
@ygrenzinger
@digitalmio passport ? have you look at it ? seems the standard for server auth
@augustovictor Seems fine to me. Only put directly the res.send(req.team); line in the mid(...) function ... but I think there is no typical "project structure and patterns" with restify (or I have missed something)
Yannick Grenzinger
@ygrenzinger
BTW i'm a simple user of Restify. It could be better if the Restify team could answer the questions :)
Maciej Ziehlke
@digitalmio
@ygrenzinger Thanks, but Passport is a oAuth Client. I’m looking for server.