In response to an audience question, Kyle shows how to add a shared data validation module. This module would be used by both the client and the server to validate user input. Sharing the module between client and server saves time and is more reusable.
(groovy music)…- Somebody asked in the chat,…how could we do something with…some shared data validation code.…So, let's try that.…Hadn't thought about it, but we'll just…on the fly, try to figure it out.…So, I will take my full js module…and I'll make another module that…I'm going to call, validate, so I'll just say,…save as, validate.js,…take out its contents for now.…
Make sure to update the name there.…Alright, let's start first by…integrating it into the server,…we could start either way, but I'm going to…integrate it into the server first,…so I'm going to go back to our unlisting my modules here.…Let's do another on called, Validate,…and then I'll come down here and load up a validate module.…
So now I have access to that validate module…from inside of my code, so let's put some validation…into our API call, let's actually send in some,…we'll need to send in some data and validate…that the data that we're sending in, is correct.…So I'm trying to think on the fly,…what kind of data would be appropriate,…let's think that, we need to pass in two pieces of data,…
Note: This course was created on 03/29/2016 by Frontend Masters. We are pleased to host this content in our library.
- Carousels, panes, and modules
- Middle-end architecture
- Secure phrase generator
- Routing functions
- Calling the API
- Rendering on the page
- Shared data validation
Skill Level Intermediate
2. Organizing Code
5. Adding a Shared Module
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.