[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-10151":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":16,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":21,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},10151,"connect","senchalabs\u002Fconnect","senchalabs","Connect is an extensible HTTP server framework for node using \"plugins\" known as middleware.","",null,"JavaScript",9885,1086,295,8,0,40.11,"MIT License",false,"master",true,[23,24],"javascript","nodejs","2026-06-12 02:02:17","\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"logo\u002Fhorizontal.png\" alt=\"connect logo\" width=\"450px\">\n\n[![NPM Version][npm-version-image]][npm-url]\n[![NPM Downloads][npm-downloads-image]][npm-url]\n[![Build Status][github-actions-ci-image]][github-actions-ci-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\n\u003C\u002Fdiv>\n\n  Connect is an extensible HTTP server framework for [node](http:\u002F\u002Fnodejs.org) using \"plugins\" known as _middleware_.\n\n```js\nvar connect = require('connect');\nvar http = require('http');\n\nvar app = connect();\n\n\u002F\u002F gzip\u002Fdeflate outgoing responses\nvar compression = require('compression');\napp.use(compression());\n\n\u002F\u002F store session state in browser cookie\nvar cookieSession = require('cookie-session');\napp.use(cookieSession({\n    keys: ['secret1', 'secret2']\n}));\n\n\u002F\u002F parse urlencoded request bodies into req.body\nvar bodyParser = require('body-parser');\napp.use(bodyParser.urlencoded({extended: false}));\n\n\u002F\u002F respond to all requests\napp.use(function(req, res){\n  res.end('Hello from Connect!\\n');\n});\n\n\u002F\u002Fcreate node.js http server and listen on port\nhttp.createServer(app).listen(3000);\n```\n\n## Getting Started\n\nConnect is a simple framework to glue together various \"middleware\" to handle requests.\n\n### Install Connect\n\n```sh\n$ npm install connect\n```\n\n### Create an app\n\nThe main component is a Connect \"app\". This will store all the middleware\nadded and is, itself, a function.\n\n```js\nvar app = connect();\n```\n\n### Use middleware\n\nThe core of Connect is \"using\" middleware. Middleware are added as a \"stack\"\nwhere incoming requests will execute each middleware one-by-one until a middleware\ndoes not call `next()` within it.\n\n```js\napp.use(function middleware1(req, res, next) {\n  \u002F\u002F middleware 1\n  next();\n});\napp.use(function middleware2(req, res, next) {\n  \u002F\u002F middleware 2\n  next();\n});\n```\n\n### Mount middleware\n\nThe `.use()` method also takes an optional path string that is matched against\nthe beginning of the incoming request URL. This allows for basic routing.\n\n```js\napp.use('\u002Ffoo', function fooMiddleware(req, res, next) {\n  \u002F\u002F req.url starts with \"\u002Ffoo\"\n  next();\n});\napp.use('\u002Fbar', function barMiddleware(req, res, next) {\n  \u002F\u002F req.url starts with \"\u002Fbar\"\n  next();\n});\n```\n\n### Error middleware\n\nThere are special cases of \"error-handling\" middleware. There are middleware\nwhere the function takes exactly 4 arguments. When a middleware passes an error\nto `next`, the app will proceed to look for the error middleware that was declared\nafter that middleware and invoke it, skipping any error middleware above that\nmiddleware and any non-error middleware below.\n\n```js\n\u002F\u002F regular middleware\napp.use(function (req, res, next) {\n  \u002F\u002F i had an error\n  next(new Error('boom!'));\n});\n\n\u002F\u002F error middleware for errors that occurred in middleware\n\u002F\u002F declared before this\napp.use(function onerror(err, req, res, next) {\n  \u002F\u002F an error occurred!\n});\n```\n\n### Create a server from the app\n\nThe last step is to actually use the Connect app in a server. The `.listen()` method\nis a convenience to start a HTTP server (and is identical to the `http.Server`'s `listen`\nmethod in the version of Node.js you are running).\n\n```js\nvar server = app.listen(port);\n```\n\nThe app itself is really just a function with three arguments, so it can also be handed\nto `.createServer()` in Node.js.\n\n```js\nvar server = http.createServer(app);\n```\n\n## Middleware\n\nThese middleware and libraries are officially supported by the Connect\u002FExpress team:\n\n  - [body-parser](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fbody-parser) - previous `bodyParser`, `json`, and `urlencoded`. You may also be interested in:\n    - [body](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fbody)\n    - [co-body](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fco-body)\n    - [raw-body](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fraw-body)\n  - [compression](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcompression) - previously `compress`\n  - [connect-timeout](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fconnect-timeout) - previously `timeout`\n  - [cookie-parser](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcookie-parser) - previously `cookieParser`\n  - [cookie-session](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcookie-session) - previously `cookieSession`\n  - [csurf](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcsurf) - previously `csrf`\n  - [errorhandler](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Ferrorhandler) - previously `error-handler`\n  - [express-session](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fexpress-session) - previously `session`\n  - [method-override](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fmethod-override) - previously `method-override`\n  - [morgan](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fmorgan) - previously `logger`\n  - [response-time](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fresponse-time) - previously `response-time`\n  - [serve-favicon](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fserve-favicon) - previously `favicon`\n  - [serve-index](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fserve-index) - previously `directory`\n  - [serve-static](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fserve-static) - previously `static`\n  - [vhost](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fvhost) - previously `vhost`\n\nMost of these are exact ports of their Connect 2.x equivalents. The primary exception is `cookie-session`.\n\nSome middleware previously included with Connect are no longer supported by the Connect\u002FExpress team, are replaced by an alternative module, or should be superseded by a better module. Use one of these alternatives instead:\n\n  - `cookieParser`\n    - [cookies](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcookies) and [keygrip](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fkeygrip)\n  - `limit`\n    - [raw-body](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fraw-body)\n  - `multipart`\n    - [connect-multiparty](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fconnect-multiparty)\n    - [connect-busboy](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fconnect-busboy)\n  - `query`\n    - [qs](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fqs)\n  - `staticCache`\n    - [st](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fst)\n    - [connect-static](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fconnect-static)\n\nCheckout [http-framework](https:\u002F\u002Fgithub.com\u002FRaynos\u002Fhttp-framework\u002Fwiki\u002FModules) for many other compatible middleware!\n\n## API\n\nThe Connect API is very minimalist, enough to create an app and add a chain\nof middleware.\n\nWhen the `connect` module is required, a function is returned that will construct\na new app when called.\n\n```js\n\u002F\u002F require module\nvar connect = require('connect')\n\n\u002F\u002F create app\nvar app = connect()\n```\n\n### app(req, res[, next])\n\nThe `app` itself is a function. This is just an alias to `app.handle`.\n\n### app.handle(req, res[, out])\n\nCalling the function will run the middleware stack against the given Node.js\nhttp request (`req`) and response (`res`) objects. An optional function `out`\ncan be provided that will be called if the request (or error) was not handled\nby the middleware stack.\n\n### app.listen([...])\n\nStart the app listening for requests. This method will internally create a Node.js\nHTTP server and call `.listen()` on it.\n\nThis is an alias to the `server.listen()` method in the version of Node.js running,\nso consult the Node.js documentation for all the different variations. The most\ncommon signature is [`app.listen(port)`](https:\u002F\u002Fnodejs.org\u002Fdist\u002Flatest-v6.x\u002Fdocs\u002Fapi\u002Fhttp.html#http_server_listen_port_hostname_backlog_callback).\n\n### app.use(fn)\n\nUse a function on the app, where the function represents a middleware. The function\nwill be invoked for every request in the order that `app.use` is called. The function\nis called with three arguments:\n\n```js\napp.use(function (req, res, next) {\n  \u002F\u002F req is the Node.js http request object\n  \u002F\u002F res is the Node.js http response object\n  \u002F\u002F next is a function to call to invoke the next middleware\n})\n```\n\nIn addition to a plan function, the `fn` argument can also be a Node.js HTTP server\ninstance or another Connect app instance.\n\n### app.use(route, fn)\n\nUse a function on the app, where the function represents a middleware. The function\nwill be invoked for every request in which the URL (`req.url` property) starts with\nthe given `route` string in the order that `app.use` is called. The function is\ncalled with three arguments:\n\n```js\napp.use('\u002Ffoo', function (req, res, next) {\n  \u002F\u002F req is the Node.js http request object\n  \u002F\u002F res is the Node.js http response object\n  \u002F\u002F next is a function to call to invoke the next middleware\n})\n```\n\nIn addition to a plan function, the `fn` argument can also be a Node.js HTTP server\ninstance or another Connect app instance.\n\nThe `route` is always terminated at a path separator (`\u002F`) or a dot (`.`) character.\nThis means the given routes `\u002Ffoo\u002F` and `\u002Ffoo` are the same and both will match requests\nwith the URLs `\u002Ffoo`, `\u002Ffoo\u002F`, `\u002Ffoo\u002Fbar`, and `\u002Ffoo.bar`, but not match a request with\nthe URL `\u002Ffoobar`.\n\nThe `route` is matched in a case-insensitive manner.\n\nIn order to make middleware easier to write to be agnostic of the `route`, when the\n`fn` is invoked, the `req.url` will be altered to remove the `route` part (and the\noriginal will be available as `req.originalUrl`). For example, if `fn` is used at the\nroute `\u002Ffoo`, the request for `\u002Ffoo\u002Fbar` will invoke `fn` with `req.url === '\u002Fbar'`\nand `req.originalUrl === '\u002Ffoo\u002Fbar'`.\n\n## Running Tests\n\n```bash\nnpm install\nnpm test\n```\n\n## People\n\nThe Connect project would not be the same without all the people involved.\n\nThe original author of Connect is [TJ Holowaychuk](https:\u002F\u002Fgithub.com\u002Ftj)\n\nThe current lead maintainer is [Douglas Christopher Wilson](https:\u002F\u002Fgithub.com\u002Fdougwilson)\n\n[List of all contributors](https:\u002F\u002Fgithub.com\u002Fsenchalabs\u002Fconnect\u002Fgraphs\u002Fcontributors)\n\n## License\n\n[MIT](LICENSE)\n\n[coveralls-image]: https:\u002F\u002Fbadgen.net\u002Fcoveralls\u002Fc\u002Fgithub\u002Fsenchalabs\u002Fconnect\u002Fmaster\n[coveralls-url]: https:\u002F\u002Fcoveralls.io\u002Fr\u002Fsenchalabs\u002Fconnect?branch=master\n[github-actions-ci-image]: https:\u002F\u002Fbadgen.net\u002Fgithub\u002Fchecks\u002Fsenchalabs\u002Fconnect\u002Fmaster?label=ci\n[github-actions-ci-url]: https:\u002F\u002Fgithub.com\u002Fjshttp\u002Fsenchalabs\u002Fconnect?query=workflow%3Aci\n[npm-downloads-image]: https:\u002F\u002Fbadgen.net\u002Fnpm\u002Fdm\u002Fconnect\n[npm-url]: https:\u002F\u002Fnpmjs.org\u002Fpackage\u002Fconnect\n[npm-version-image]: https:\u002F\u002Fbadgen.net\u002Fnpm\u002Fv\u002Fconnect\n","Connect 是一个基于 Node.js 的可扩展 HTTP 服务器框架，通过中间件（middleware）插件机制来处理请求。其核心功能包括支持多种中间件如压缩、会话管理及请求体解析等，以实现灵活的功能组合与扩展。技术上，Connect 允许开发者通过链式调用方式添加多个中间件，每个中间件负责处理特定的任务，并可以选择性地将控制权传递给下一个中间件。此外，它还提供了错误处理中间件的支持，确保应用程序能够优雅地处理异常情况。适用于需要构建轻量级Web服务或API接口的场景，特别是当项目需求较为简单且注重快速开发时。",2,"2026-06-11 03:26:53","top_topic"]