From 3cf112bb6b9d85b9b931f8ff575b5ba3b10ed747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20D=C3=BC=C3=BCna?= Date: Thu, 16 Jul 2015 12:14:45 +0300 Subject: [PATCH] Easy-x-headers --- easy-x-headers/easy-x-headers-tests.ts | 16 ++++++++++++++++ easy-x-headers/easy-x-headers.d.ts | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 easy-x-headers/easy-x-headers-tests.ts create mode 100644 easy-x-headers/easy-x-headers.d.ts diff --git a/easy-x-headers/easy-x-headers-tests.ts b/easy-x-headers/easy-x-headers-tests.ts new file mode 100644 index 000000000..9a306ea6a --- /dev/null +++ b/easy-x-headers/easy-x-headers-tests.ts @@ -0,0 +1,16 @@ +/** + * Created by karl on 14/07/15. + */ + +/// +/// + +import express = require('express'); +import xHeaders = require('easy-x-headers'); + +var app = express(); +app.use(xHeaders.getMiddleware()); + +app.get('/', function (req, res) { + res.json(req.info); +}); diff --git a/easy-x-headers/easy-x-headers.d.ts b/easy-x-headers/easy-x-headers.d.ts new file mode 100644 index 000000000..c0a13d1a8 --- /dev/null +++ b/easy-x-headers/easy-x-headers.d.ts @@ -0,0 +1,18 @@ +// Type definitions for easy-x-headers +// Project: https://github.com/DeadAlready/easy-x-headers +// Definitions by: Karl Düüna +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + export interface Request { + info: any; + } +} + +declare module "easy-x-headers" { + import express = require('express'); + + export function getMiddleware(): express.RequestHandler; +}