ukayani / restify-router

A router interface for restify that lets you aggregate route definitions and apply to a restify server
MIT License
52 stars 15 forks source link

Added type definitions. #20

Closed otaviotech closed 6 years ago

otaviotech commented 6 years ago

It allows us to use RestifyRouter in TypeScript powered projects without need to make some known tricks like: declare var.

ukayani commented 6 years ago

Hi, thanks for the addition. Does this change cause any issues for non-type-script projects?

ukayani commented 6 years ago

Also, is there a way to inherit from the Restify Server type for the Router type? The intention of the router is to have the same interface as the server (plus the applyRoutes)

otaviotech commented 6 years ago

Hi, thanks for replying!

Hi, thanks for the addition. Does this change cause any issues for non-type-script projects?

No, it only affects TypeScript projects by adding code completion and importing, which now can be made with:

import { Router as RestifyRouter } from 'restify-router'

Also, is there a way to inherit from the restify Server type for the Router type? The intention of the router is to have the same interface as the server (plus the applyRoutes)

I don't think so... What I found is that the restify Server class inherits from nodes http.Server and it has more methods, which are not implemented by restify-router, so I don't know if it would be possible.

Did I answered your questions correctly? Thank you!

ukayani commented 6 years ago

sounds good. i'll create a release soon.