mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Vendored
+2
-2
@@ -27,7 +27,7 @@ declare module Express {
|
||||
export interface Response {
|
||||
success (data?: any, status?: number): void;
|
||||
fail (data: any, status?: number): void;
|
||||
error (err: any): void;
|
||||
error (err: any, status?: number): void;
|
||||
partial? (data: PartialInput, status?: number): void;
|
||||
makePartial? (data: MakePartialInput): void;
|
||||
}
|
||||
@@ -35,4 +35,4 @@ declare module Express {
|
||||
|
||||
declare module "easy-jsend" {
|
||||
export function init(conf?:{partial:boolean}): void;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -14,5 +14,5 @@ declare module Express {
|
||||
declare module "easy-x-headers" {
|
||||
import express = require('express');
|
||||
|
||||
export function getMiddleware(): express.RequestHandler;
|
||||
export function getMiddleware(defaults?: Object): express.RequestHandler;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Created by karl on 14/07/15.
|
||||
*/
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="./easy-xapi.d.ts" />
|
||||
|
||||
import express = require('express');
|
||||
import eXapi = require('easy-xapi');
|
||||
|
||||
eXapi.init({
|
||||
jSend: {
|
||||
partial: true
|
||||
}
|
||||
});
|
||||
|
||||
var xApi = eXapi.create({
|
||||
root: __dirname,
|
||||
log: {
|
||||
name: 'Log',
|
||||
level: 'info'
|
||||
},
|
||||
port: 3000,
|
||||
name: 'test',
|
||||
mount: function (app) {
|
||||
app.get('/', function (req, res) {
|
||||
res.send('ok');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
xApi.listen();
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// Type definitions for easy-xapi
|
||||
// Project: https://github.com/DeadAlready/easy-xapi
|
||||
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../easy-jsend/easy-jsend.d.ts" />
|
||||
/// <reference path="../bunyan/bunyan.d.ts" />
|
||||
|
||||
declare module Express {
|
||||
export interface Request {
|
||||
log: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "easy-xapi" {
|
||||
import express = require('express');
|
||||
import http = require('http');
|
||||
import bunyan = require('bunyan');
|
||||
|
||||
interface InitConfig {
|
||||
jSend?: {partial: boolean};
|
||||
}
|
||||
|
||||
interface Config {
|
||||
root: string;
|
||||
port: number;
|
||||
name: string;
|
||||
xHeaderDefaults?: Object;
|
||||
log: {
|
||||
name: string;
|
||||
level: string
|
||||
}
|
||||
mount: (app: express.Application) => void
|
||||
}
|
||||
|
||||
interface Result {
|
||||
express: any;
|
||||
app: express.Application;
|
||||
server: http.Server;
|
||||
log: bunyan.Logger;
|
||||
listen: () => void;
|
||||
}
|
||||
|
||||
export function init(conf: InitConfig): void;
|
||||
export function create(conf: Config): Result;
|
||||
}
|
||||
Reference in New Issue
Block a user