Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create express body parser #21

Open
SamVerschueren opened this issue Jul 31, 2014 · 5 comments
Open

Create express body parser #21

SamVerschueren opened this issue Jul 31, 2014 · 5 comments
Labels

Comments

@SamVerschueren
Copy link
Contributor

Before ExpressJS 4.x, the bodyparser was part of the express library. But since 4.x they removed a lot of the built in functionality and created all seperate libraries (body-parser, csurf, session, ...). For now, it's only possible to retrieve simple body data submitted by a form. It would be a nice idea if we created a body-parser library that we can maintain seperately from the express library.

Later on we can even create extra libraries like csurf, session, ...

It's just an idea, what do you guys think?

@mythz
Copy link
Contributor

mythz commented Jul 31, 2014

A separate library at an early stage just adds friction and versioning issues. IMO better to keep things simple and have a more complete functioning core, then later extract out if need be, i.e. when there's interest in re-use of the body parsers outside of express. Until then just adds more burden on the user.

@SamVerschueren
Copy link
Contributor Author

Yes your probably right. Would it be better to built it in in the core or create seperate classes? Something like this

var app = new Express();
app.use(new JSONBodyParser());
app.post('/api/user/create', (ctx) {
   var body = ctx.body;
});

Or you would rather see it like

var app = new Express();
app.post('/api/user/create', (ctx) {
   var body = ctx.body;
});

@mythz
Copy link
Contributor

mythz commented Jul 31, 2014

IMO core stuff like JSON should be baked in the box so users need not worry about it.

It would be nice to modularize it so JSON support can be encapsulated in a class and autoregistered by default, but then provide users an opportunity to remove the modules/features they don't want. I've enabled something like this in ServiceStack Plugins which enables the most popular plugins by default into a modifyable collection, which can later be introspected, added to and removed.

@SamVerschueren
Copy link
Contributor Author

@mythz Would be nice to have something like that. Will look into if when I resolved the other issue. Didn't find the time yet

@thosakwe
Copy link

Super old issue, but if you're still looking for something like this, I built it over a year ago: https://github.com/thosakwe/body_parser

It's used in the Angel framework, which is a good alternative to this library, seeing as it hasn't been updated in years. https://github.com/angel-dart/angel/wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants