From the course: Node.js: Design Patterns
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Implementing a proxy - Node.js Tutorial
From the course: Node.js: Design Patterns
Implementing a proxy
- [Instructor] In the last lesson, we defined the proxy pattern, as well as we introduced some code where we might be able to use a proxy. So, currently we're looking at the files within our exercise files, under chapter three, lesson four, within the start folder, and we're taking a look at the index.js file, which is allowing us to read both text and Markdown files. Now, a proxy is an object that controls access to another object. There are a number of wonderful things that you can do with a proxy, and one of those is restricting access to the actual object. So that's what we're going to do. We're going to create a file system proxy that only allows us to read Markdown files, it won't let us read any files of any other types. So, when we create our proxy, what I'm going to do inside of the index.js file, is use it. So, we're going to create something called a FS_Proxy, and now I'm going to go ahead and use the FS_Proxy…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
The Adapter pattern2m 20s
-
(Locked)
Implementing an adapter6m 24s
-
(Locked)
The Proxy pattern2m 11s
-
(Locked)
Implementing a proxy5m 48s
-
(Locked)
The Composite pattern3m 12s
-
(Locked)
Implementing composites5m 59s
-
(Locked)
The Decorator pattern4m 3s
-
(Locked)
Implementing decorators4m 24s
-
(Locked)
-
-