mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Add restify definition
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/// <reference path="restify.d.ts" />
|
||||
|
||||
import restify = module("restify");
|
||||
|
||||
var server = restify.createServer({
|
||||
formatters: {
|
||||
'application/foo': function formatFoo(req, res, body) {
|
||||
if (body instanceof Error)
|
||||
return body.stack;
|
||||
|
||||
if (body)
|
||||
return body.toString('base64');
|
||||
|
||||
return body;
|
||||
}
|
||||
}
|
||||
});
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
interface Server {
|
||||
use: (... handler: any[]) => any;
|
||||
post: (route: any, routeCallBack: (req: any, res: any, next: any) => any) => any;
|
||||
put: (route: any, routeCallBack: (req: any, res: any, next: any) => any) => any;
|
||||
del: (route: any, routeCallBack: (req: any, res: any, next: any) => any) => any;
|
||||
get: (route: any, routeCallBack: (req: any, res: any, next: any) => any) => any;
|
||||
head: (route: any, routeCallBack: (req: any, res: any, next: any) => any) => any;
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
certificate ?: string;
|
||||
key ?: string;
|
||||
formatters ?: Object;
|
||||
log ?: Object;
|
||||
name ?: string;
|
||||
spdy ?: Object;
|
||||
version ?: string;
|
||||
responseTimerHeader ?: string;
|
||||
responseTimeFormatter ?: (durationInMilliseconds: number) => any;
|
||||
}
|
||||
|
||||
declare module "restify" {
|
||||
export function createServer(options: ServerOptions): Server;
|
||||
export class ConflictError { new(message: any): ConflictError; };
|
||||
export class InvalidArguementError { new(message: any): InvalidArguementError; };
|
||||
export class RestError { new(message: any): RestError; };
|
||||
export class BadDigestError { new(message: any): BadDigestError; };
|
||||
export class BadMethodError { new(message: any): BadMethodError; };
|
||||
export class InternalError { new(message: any): InternalError; };
|
||||
export class InvalidContentError { new(message: any): InvalidContentError; };
|
||||
export class InvalidCredentialsError { new(message: any): InvalidCredentialsError; };
|
||||
export class InvalidHeaderError { new(message: any): InvalidHeaderError; };
|
||||
export class InvalidVersionError { new(message: any): InvalidVersionError; };
|
||||
export class MissingParameterError { new(message: any): MissingParameterError; };
|
||||
export class NotAuthorizedError { new(message: any): NotAuthorizedError; };
|
||||
export class RequestExpiredError { new(message: any): RequestExpiredError; };
|
||||
export class RequestThrottledError { new(message: any): RequestThrottledError; };
|
||||
export class ResourceNotFoundError { new(message: any): ResourceNotFoundError; };
|
||||
export class WrongAcceptError { new(message: any): WrongAcceptError; };
|
||||
}
|
||||
Reference in New Issue
Block a user