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

A route DSL sugar middleware for noflow #10

Open
ysmood opened this issue Aug 17, 2015 · 6 comments
Open

A route DSL sugar middleware for noflow #10

ysmood opened this issue Aug 17, 2015 · 6 comments

Comments

@ysmood
Copy link
Owner

ysmood commented Aug 17, 2015

Such as

let http = require('http');
let { route, flow } = kit.proxy;

route
  .get('/items', ctx => ctx.body = [1, 2, 3])
  .post('/upload', uploader)
  .error(errorHanlder)
.end();

http.createServer(flow(route)).listen(8080);

@magnus-

@magnus-
Copy link

magnus- commented Aug 19, 2015

I prefer to apply the DSL as illustrated below:

// acquire an instance of verbalizer
var I = verbalizer();

// GET /getUserInfo
// method getUserInfo can injected within global scope
I.get.an.instance.of('UserInfo').by.method('getUserInfo')
    .with.arguments.schema('SchemaUser')
    .when.arguments.error('status 400').with.comment('input argument invalid')

The syntax of the verbalizer can be discussed later

@ysmood
Copy link
Owner Author

ysmood commented Aug 19, 2015

A good point to start.

@ysmood
Copy link
Owner Author

ysmood commented Aug 19, 2015

So what's your plan to implement it?

@magnus-
Copy link

magnus- commented Aug 20, 2015

I’ll take several days to weave the syntax tree and to determinate words category. Besides, words for different purpose usage can be gathered into different categories, which you could reckon them as normal English grammatical categories something like conjunction or predicate.

And what matters most will be the customization of the injection and error handling.

The essentiality of the Verbalizer is to promote user with straightforward syntax-bound words to documentize their logic behavior.

@magnus-
Copy link

magnus- commented Aug 20, 2015

Additionally, Verbalizer should stick to express or other middle-ware based frameworks as well. What do u think? @ysmood

@ysmood
Copy link
Owner Author

ysmood commented Aug 20, 2015

For now, I don't have any better idea than yours. Looking forward to your code.

@ysmood ysmood assigned ysmood and unassigned ysmood May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants