mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
easy-xapi
This commit is contained in:
32
easy-xapi/easy-xapi-tests.ts
Normal file
32
easy-xapi/easy-xapi-tests.ts
Normal file
@@ -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();
|
||||
44
easy-xapi/easy-xapi.d.ts
vendored
Normal file
44
easy-xapi/easy-xapi.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// 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" />
|
||||
|
||||
declare module Express {
|
||||
export interface Request {
|
||||
log: any;
|
||||
info: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "easy-xapi" {
|
||||
import express = require('express');
|
||||
import http = require('http');
|
||||
|
||||
interface InitConfig {
|
||||
jSend?: {partial: boolean};
|
||||
}
|
||||
|
||||
interface Config {
|
||||
root: string;
|
||||
port: number;
|
||||
name: string;
|
||||
log: {
|
||||
name: string;
|
||||
level: string
|
||||
}
|
||||
mount: (app: express.Application) => void
|
||||
}
|
||||
|
||||
interface Result {
|
||||
express: any;
|
||||
app: express.Application;
|
||||
server: http.Server;
|
||||
listen: () => void;
|
||||
}
|
||||
|
||||
export function init(conf: InitConfig): void;
|
||||
export function create(conf: Config): Result;
|
||||
}
|
||||
Reference in New Issue
Block a user