Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

index.d.ts 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Type definitions for Express 4.17
  2. // Project: http://expressjs.com
  3. // Definitions by: Boris Yankov <https://github.com/borisyankov>
  4. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
  5. // TypeScript Version: 2.3
  6. /* =================== USAGE ===================
  7. import * as express from "express";
  8. var app = express();
  9. =============================================== */
  10. /// <reference types="express-serve-static-core" />
  11. /// <reference types="serve-static" />
  12. import * as bodyParser from "body-parser";
  13. import serveStatic = require("serve-static");
  14. import * as core from "express-serve-static-core";
  15. /**
  16. * Creates an Express application. The express() function is a top-level function exported by the express module.
  17. */
  18. declare function e(): core.Express;
  19. declare namespace e {
  20. /**
  21. * This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.
  22. * @since 4.16.0
  23. */
  24. var json: typeof bodyParser.json;
  25. /**
  26. * This is a built-in middleware function in Express. It parses incoming requests with Buffer payloads and is based on body-parser.
  27. * @since 4.17.0
  28. */
  29. var raw: typeof bodyParser.raw;
  30. /**
  31. * This is a built-in middleware function in Express. It parses incoming requests with text payloads and is based on body-parser.
  32. * @since 4.17.0
  33. */
  34. var text: typeof bodyParser.text;
  35. /**
  36. * These are the exposed prototypes.
  37. */
  38. var application: Application;
  39. var request: Request;
  40. var response: Response;
  41. /**
  42. * This is a built-in middleware function in Express. It serves static files and is based on serve-static.
  43. */
  44. var static: typeof serveStatic;
  45. /**
  46. * This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser.
  47. * @since 4.16.0
  48. */
  49. var urlencoded: typeof bodyParser.urlencoded;
  50. export function Router(options?: RouterOptions): core.Router;
  51. interface RouterOptions {
  52. /**
  53. * Enable case sensitivity.
  54. */
  55. caseSensitive?: boolean;
  56. /**
  57. * Preserve the req.params values from the parent router.
  58. * If the parent and the child have conflicting param names, the child’s value take precedence.
  59. *
  60. * @default false
  61. * @since 4.5.0
  62. */
  63. mergeParams?: boolean;
  64. /**
  65. * Enable strict routing.
  66. */
  67. strict?: boolean;
  68. }
  69. interface Application extends core.Application { }
  70. interface CookieOptions extends core.CookieOptions { }
  71. interface Errback extends core.Errback { }
  72. interface ErrorRequestHandler extends core.ErrorRequestHandler { }
  73. interface Express extends core.Express { }
  74. interface Handler extends core.Handler { }
  75. interface IRoute extends core.IRoute { }
  76. interface IRouter<T> extends core.IRouter { }
  77. interface IRouterHandler<T> extends core.IRouterHandler<T> { }
  78. interface IRouterMatcher<T> extends core.IRouterMatcher<T> { }
  79. interface MediaType extends core.MediaType { }
  80. interface NextFunction extends core.NextFunction { }
  81. interface Request extends core.Request { }
  82. interface RequestHandler extends core.RequestHandler { }
  83. interface RequestParamHandler extends core.RequestParamHandler { }
  84. export interface Response extends core.Response { }
  85. interface Router extends core.Router { }
  86. interface Send extends core.Send { }
  87. }
  88. export = e;