Comments (5)
i'd rather rip all the middleware out.
we should just implement JSON support inline, it already requires specifial hooks outside of the "middleware" stuff.
from tako.
Hm. Yeah, I guess you can just do exactly the same thing by listening to app.on("request", myMiddlewareBits).
That still doesn't make it possible to attach filters, though. I suppose you could probably do something like this:
var s = req.socket
var f = zlib.Unzip()
s.pipe(f)
req.socket = f
var s = res.socket
var f = zlib.Gzip()
f.pipe(s)
res.socket = f
but that's of course getting super overly familiar with implementation internals.
from tako.
yup, the only thing the framework needs hooks for are conditions that will require IO to complete and might need to be required for a route.
auth is one, sessions are another. I want to change the way auth is implemented in to a more generic "condition" system we can use for sessions and other things.
from tako.
But, no, you could still do json support as a purely external middleware thing if you could attach filters. Just define a stream filter that takes in Objects and spits out JSON, and another that takes JSON and spits out objects. The only other part is setting the content-type and accept headers appropriately.
from tako.
Hi!
I've implemented a gzip-middleware for tako https://github.com/kesla/tako-gzip. The suggested code that @isaacs wrote earlier doesn't work, since that gzips the headers also.
Instead I overwrote the _work and _end-methods in the response...
Heavily dependent on implementation internails...
from tako.
Related Issues (13)
- session token cookies HOT 2
- npm version > git version
- Feedback HOT 8
- Handlebars.registerHelper support
- tako crashes when a put or post request has no content-type header
- resp.redirect method
- maple 0.3.0 breaks .files HOT 1
- Action required: Greenkeeper could not be activated 🚨
- Action required: Greenkeeper could not be activated 🚨
- .DS_Store in the templates folder causes stupid error HOT 2
- make templates dir accept a regex
- app.route("...").form() method
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 tako.