restify / restify/node-restify

Support serve-static from express

Open
#1,617 1 comment 5 reactions 1 assignee View on GitHub

@retrohacker is already working on this.

Since Feb 27, 2018.

Feature Needs Discussion Serve
Dominant language
JavaScript
Stars
10.7k
Forks
975
Avg merge
1d 6h
Merged PRs (30d)
5

Description

  • Used appropriate template for the issue type
  • Searched both open and closed issues for duplicates of this issue
  • Title adequately and concisely reflects the feature or the bug

Feature Request

Use Case

It would be super cool if we could just use the serve-static plugin from the express ecosystem instead of continuing to invest in maintaining a parallel (and broken) internal serveStatic plugin.

Why do you want this?

Example API

var restify = require('restify');
var serveStatic = require('serve-static');

var app = restify.createServer();
var serve = serveStatic('./static');

app.get('.*', function(req, res, next) {
    res.addListener('finish', next);
    serve(req, res, function (err) {
        res.removeListener('finish', next);
        next(err);
     });
});

app.listen(8080);

It also looks like we need to support the req.originalUrl pattern similar to express: https://github.com/expressjs/express/blob/c0136d8b48dd3526c58b2ad8666fb4b12b55116c/lib/router/index.js#L172

This should include code snippets and documentation for the proposed feature

Are you willing and able to implement this?

"Yes" or, if "no", what can current contributors do to help you create a PR?

Yup!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.