question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi, we (restify maintainers) are looking at deprecating the existing serve static plugin that ships with restify in favor of something that’s being actively maintained. This is one of the modules on the short list, and I wanted to start a conversation around what would be needed to fully support restify. I’d be happy to do the initial work, but thought that starting here first would be most practical.

restify uses the same middleware chaining as express, so ecstatic works out of the box for all the basic happy paths. There are two things I think we’d need to get 100% support:

  1. option to always invoke next(), regardless of success/failure. restify uses this for various things, but it’s important that next() is always called when ecstatic is done.
  2. an option to avoid writing errors (fallback or not) out to the response, and instead pass any error objects on to next(). this can be done as a subset option of the first one, or as a completely independent option (but that seems to make less sense, I think, as I can’t imagine enabling option 2 independently).

In short, happy paths can write out to the res as is, but anytime an error occurs, we’d like that error object propagated to next. restify uses events to give consumers fine grained control over different error types, so it’s important that we can get at the underlying error object. The cherry on top would be attaching an http status code to that error object (whatever status ecstatic thinks is is most appropriate).

I did some poking around and I think it’s doable, but it is going to require a little futzing of the status handlers as well as the recursive cases to ensure that next() is always called. And in some cases, ‘error’ cases don’t always have an error object associated with it, and we’d have to create one (for example, in the scenario that the request is terminated from the client). Would love to get your thoughts. Thanks!

FYI @micahr @yunong.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
DonutEspressocommented, Mar 15, 2017

@jeevank I started the work but was unable to work through a bunch of failing tests in the time frame I had - unfortunately, never got a chance to pick things back up. We would still like to make this happen, though!

0reactions
DonutEspressocommented, Apr 10, 2017

@dotnetCarpenter I had the work sitting on a local branch on my old machine, but the HDD died over the winter break. 😦 I recall there wasn’t a whole lot of work - it’s more around debugging the odd corner case here and there (in particular, the error cases). Unfortunately it doesn’t look like I’ll get a chance to dig into this anytime soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restify
A Node.js web service framework optimized for building semantically correct RESTful web services ready for production use at scale. restify optimizes for ...
Read more >
restify/node-restify: The future of Node.js REST development
Supported Node Versions. Restify currently works on Node.js v14.x and v16.x. License. The MIT License (MIT).
Read more >
API Guide | restify Documentation
For real time chat, discussion and support, join the #restify IRC channel on irc.freenode.net . About this guide. This guide provides comprehensive ...
Read more >
Restify.JS: Your Production Ready REST API At Scale With ...
js. As the main website suggests, Restify is a Node.js web service framework optimized for building semantically correct RESTful web services ...
Read more >
Restify Performance Monitoring | Node.js - AppDynamics
Catch application anomalies and performance problems with Restify performance monitoring. You can monitor, troubleshoot & diagnose issues with AppDynamics.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found