add definitions for koa-favicon

This commit is contained in:
hellopao
2016-04-06 19:55:40 +08:00
committed by Masahiro Wakame
parent 09ac2c31e2
commit 15337e2b66
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
/// <reference path="../koa/koa.d.ts" />
/// <reference path="koa-favicon.d.ts" />
import * as Koa from "koa";
import favicon = require("koa-favicon");
const app = new Koa();
app.use(favicon(__dirname + "/public/favicon.ico"));
app.listen(80)

35
koa-favicon/koa-favicon.d.ts vendored Normal file
View File

@@ -0,0 +1,35 @@
// Type definitions for koa-favicon v2.x
// Project: https://github.com/koajs/favicon
// Definitions by: Jerry Chin <https://github.com/hellopao/>
// Definitions: https://github.com/hellopao/DefinitelyTyped
/* =================== USAGE ===================
import favicon = require("koa-favicon");
var Koa = require('koa');
var app = new Koa();
app.use(favicon(__dirname + '/public/favicon.ico'));
=============================================== */
/// <reference path="../koa/koa.d.ts" />
declare module "koa-favicon" {
import * as Koa from "koa";
/**
* Returns a middleware serving the favicon found on the given path.
*/
function favicon(path: string, options?: {
/**
* cache-control max-age directive in ms, defaulting to 1 day.
*/
maxage?: number;
}): { (ctx: Koa.Context, next?: () => any): any };
export = favicon;
}