Comments (9)
All I see at connect/index.js
(where the error originates) is
/**
- Stack the given middleware
handle
to the givenroute
.
* - @param {String} route
- @param {Function} handle
- @return {Server}
- @api public
*/
Ok, so "route" is a string, not a function. (That ambiguity in the error message should be eliminated.) But anyway, what does this mean? "Route" as in the "router" middleware? I can't see how that has anything to do with it, and I can't think of another relevant type of "route" this could be.
from connect.
shit, year static()
should be staticProvider()
. I am not sure that "route" is the proper word to describe it, personally I would call it a "mount path" or something, but basically it allows you to "mount" say the static middleware to a specific base path, for example server.use("/public", connect.staticProvider())
from connect.
... ok. I don't think I understand. Let's take the examples at http://howtonode.org/connect-it . Neither the "from scratch" app, nor the "robust using built-in" app, work: when I run connect server.js
, I get
/home/lm/.node_libraries/connect/index.js:146
throw new Error("Each layer must have a route and a handle function");
I get exactly the same if I set exports.route in serve-js.js
and log-it.js
, like so:
exports.route = __dirname;
So to keep this simple, how should the tutorial at the above URL be changed for it to now work?
from connect.
that tutorial is pretty old now.. you can basically use the example above, with staticProvider instead of "static" (which I will fix), and run connect
from connect.
Perhaps I should update the article. Updating...
from connect.
Many examples with latest connect and express don't work. "Each layer must have a route and a handle function" in all of them. Bug?
from connect.
its because I made a change to allow server.use(fn)
instead of server.use('/', fn)
my examples use the former, which unfortunately will blow up right now, I should switch them until a new connect is released
from connect.
if it's for me it's ok... given that you can pass those into express.createServer() without a path ... so no biggie. thanks
from connect.
my and guillermo had a big talk about dependencies. its a stupid issue with node stuff right now. git IS a package manager essentially, we talked about vendorizing connect in express, but it leads to other problems so I dont have a good answer at this moment but the preferred install method would probably be $ curl http://expressjs.com/install.sh | sh
from connect.
Related Issues (20)
- Stream based middleware for response modification HOT 4
- cannot install connect using npm HOT 4
- use regexp to replace 'getProtohost' HOT 2
- finalhandler vulnerability HOT 6
- logo contribution HOT 3
- Settle on `res.locals` as mechanism for sharing config between middleware HOT 8
- Accepts array for middleware HOT 5
- TypeError: Cannot read property 'send' of undefined HOT 1
- Support route patterns HOT 1
- Documentation for "Node.js http request object" HOT 7
- Drop unsupported Node.js version HOT 1
- Not clear comment HOT 1
- whether can we give up nodejs that is less than version 7 ? HOT 5
- whether can we redesign connect code in ecmascript 2015+ syntax? HOT 3
- Error while using express-rate-limit HOT 1
- release HOT 2
- ConnectIkonic
- Content-Type: 'application/fhir+json' HOT 2
- route is not support params HOT 1
- bug: redirecting to external URLs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect.