mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
add definitions for koa-favicon
This commit is contained in:
committed by
Masahiro Wakame
parent
09ac2c31e2
commit
15337e2b66
11
koa-favicon/koa-favicon-tests.ts
Normal file
11
koa-favicon/koa-favicon-tests.ts
Normal 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
35
koa-favicon/koa-favicon.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user