comments inline.

On 01/22/2013 01:56 PM, Alan Hoffmeister wrote:
> Well, generaly I don't wait for the db to throw a duplication error to
> warn the user that he needs to pick up another username. But of course,
> if the form is 100% valid I still need to take care about his username
> at the db layer.
> 

Then you're doing register wrong.

> Another example: I need to check if a file exists, send a request to a
> rest server to check the file metadata and convert a markdown field to
> HTML using the GitHub's API, that would be a hell of a process that I
> can't encapsulate inside all those validation modules mentioned here
> without spliting the process a couple of times.
> 

Be more specific, what do you want to validate against?

If validation depends on external data then pre-fetch them yourself.

eg: When you're handling a sign in request, you query the db for a user
with that username, hash the provided password, and compare with the
hashed password in the user record from the db. And you want to validate
that they are equal. If you were to validate this using a validation
library, you'd fetch the user record from the db, and then use the
validation library. You wouldn't ask the validation library to fetch the
user record from the db.

danmilon.

> That's the main idea about the validation/sanitization module that I'm
> building: async from ground up.
> 
> 
> --
> Att,
> Alan Hoffmeister
> 
> 
> 2013/1/22 Pedro Teixeira <pedro.teixe...@gmail.com
> <mailto:pedro.teixe...@gmail.com>>
> 
>     Duplicate validation should be handled at the persistence layer, not
>     in Node, since you have a concurrency issue there (think of 2
>     simultaneous requests).
> 
>     -- 
>     Pedro
> 
>     On Tuesday, January 22, 2013 at 11:06 AM, Alan Hoffmeister wrote:
> 
>>     So how do you validate duplicated username, e-mail, etc..? As far
>>     as I could see I need to split the validation process for this,
>>     and I think that this is fucking up with the validation.
>>
>>     --
>>     Att,
>>     Alan Hoffmeister
>>
>>
>>     2013/1/22 Jake Verbaten <rayn...@gmail.com <mailto:rayn...@gmail.com>>
>>>     Your validating logic is only async if it does IO. 
>>>
>>>     If your validation does IO you fucked up. You don't need async
>>>     support.
>>>
>>>
>>>     On Mon, Jan 21, 2013 at 10:11 AM, Alan Hoffmeister
>>>     <alanhoffmeis...@gmail.com <mailto:alanhoffmeis...@gmail.com>> wrote:
>>>>     Katsumoto, thats a nice well known package, but I think that
>>>>     lacks async support.
>>>>
>>>>     --
>>>>     Att,
>>>>     Alan Hoffmeister
>>>>
>>>>
>>>>     2013/1/21 Katsumoto <shogun...@gmail.com
>>>>     <mailto:shogun...@gmail.com>>
>>>>>     take a look at https://github.com/chriso/node-validator
>>>>>
>>>>>     пятница, 18 января 2013 г., 13:07:13 UTC+2 пользователь Alan
>>>>>     Hoffmeister написал:
>>>>>>     Hello fellows!
>>>>>>
>>>>>>     How are you doing data validation like forms and other user
>>>>>>     inputs? I know that there is some modules to do that but my
>>>>>>     intention is to do a brainstorm to gather ideas for a new
>>>>>>     module that I'm developing.
>>>>>>
>>>>>>     Thanks.
>>>>>>
>>>>>>     --
>>>>>>     Att,
>>>>>>     Alan Hoffmeister
>>>>>
>>>>>     -- 
>>>>>     Job Board: http://jobs.nodejs.org/
>>>>>     Posting guidelines:
>>>>>     https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>>>>     You received this message because you are subscribed to the Google
>>>>>     Groups "nodejs" group.
>>>>>     To post to this group, send email to nodejs@googlegroups.com
>>>>>     <mailto:nodejs@googlegroups.com>
>>>>>     To unsubscribe from this group, send email to
>>>>>     nodejs+unsubscr...@googlegroups.com
>>>>>     <mailto:nodejs%2bunsubscr...@googlegroups.com>
>>>>>     For more options, visit this group at
>>>>>     http://groups.google.com/group/nodejs?hl=en?hl=en
>>>>
>>>>     -- 
>>>>     Job Board: http://jobs.nodejs.org/
>>>>     Posting guidelines:
>>>>     https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>>>     You received this message because you are subscribed to the Google
>>>>     Groups "nodejs" group.
>>>>     To post to this group, send email to nodejs@googlegroups.com
>>>>     <mailto:nodejs@googlegroups.com>
>>>>     To unsubscribe from this group, send email to
>>>>     nodejs+unsubscr...@googlegroups.com
>>>>     <mailto:nodejs%2bunsubscr...@googlegroups.com>
>>>>     For more options, visit this group at
>>>>     http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>>     -- 
>>>     Job Board: http://jobs.nodejs.org/
>>>     Posting guidelines:
>>>     https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>>     You received this message because you are subscribed to the Google
>>>     Groups "nodejs" group.
>>>     To post to this group, send email to nodejs@googlegroups.com
>>>     <mailto:nodejs@googlegroups.com>
>>>     To unsubscribe from this group, send email to
>>>     nodejs+unsubscr...@googlegroups.com
>>>     <mailto:nodejs%2bunsubscr...@googlegroups.com>
>>>     For more options, visit this group at
>>>     http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>>     -- 
>>     Job Board: http://jobs.nodejs.org/
>>     Posting guidelines:
>>     https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>     You received this message because you are subscribed to the Google
>>     Groups "nodejs" group.
>>     To post to this group, send email to nodejs@googlegroups.com
>>     <mailto:nodejs@googlegroups.com>
>>     To unsubscribe from this group, send email to
>>     nodejs+unsubscr...@googlegroups.com
>>     <mailto:nodejs+unsubscr...@googlegroups.com>
>>     For more options, visit this group at
>>     http://groups.google.com/group/nodejs?hl=en?hl=en
> 
>     -- 
>     Job Board: http://jobs.nodejs.org/
>     Posting guidelines:
>     https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>     You received this message because you are subscribed to the Google
>     Groups "nodejs" group.
>     To post to this group, send email to nodejs@googlegroups.com
>     <mailto:nodejs@googlegroups.com>
>     To unsubscribe from this group, send email to
>     nodejs+unsubscr...@googlegroups.com
>     <mailto:nodejs%2bunsubscr...@googlegroups.com>
>     For more options, visit this group at
>     http://groups.google.com/group/nodejs?hl=en?hl=en
> 
> 
> -- 
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to