forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed38db4
commit 978ee56
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// <reference path="./connect-flash.d.ts" /> | ||
|
||
import express = require('express'); | ||
import flash = require('connect-flash'); | ||
|
||
var app = express(); | ||
|
||
app.use(flash()); | ||
app.use(flash({ | ||
unsafe: false | ||
})); | ||
|
||
app.use(function(req: Express.Request, res, next) { | ||
req.flash('Message'); | ||
req.flash('info', 'Message'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Type definitions for connect-flash | ||
// Project: https://github.com/jaredhanson/connect-flash | ||
// Definitions by: Andreas Gassmann <https://github.com/AndreasGassmann/> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../express/express.d.ts" /> | ||
|
||
declare module Express { | ||
export interface Request { | ||
flash(message: string): any; | ||
flash(event: string, message: string): any; | ||
} | ||
} | ||
|
||
declare module "connect-flash" { | ||
import express = require('express'); | ||
interface IConnectFlashOptions { | ||
unsafe?: boolean; | ||
} | ||
function e(options?: IConnectFlashOptions): express.RequestHandler; | ||
export = e; | ||
} |