Table of Contents
1.Interceptor definition
5.3.2 Interceptor configuration
2.1 Configure an interceptor for a certain mapping
2.2 Configure global interceptors for all mappings
3.Interception test
3.1 Testing requirements
3.2Write two interceptors
3.3 Both interceptors are allowed
3.4 Interceptor 1 is allowed, Interceptor 2 is not allowed
3.5 Interceptor 1 is not allowed, Interceptor 2 is not allowed
4. Summary
5.Interceptor application (implementing login authentication)
5.1 Requirements
5.2 Login and exit controller methods
5.3 Login authentication interception implementation
5.3.1LoginInterceptor
Home Java javaTutorial Spring+SpringMVC+MyBatis in-depth learning and construction (17) - SpringMVC interceptor

Spring+SpringMVC+MyBatis in-depth learning and construction (17) - SpringMVC interceptor

Jul 03, 2017 pm 05:30 PM
seventeen build

Please indicate the source:

As mentioned earlier: Spring+SpringMVC+MyBatis in-depth learning and construction (16) - SpringMVC annotation development (advanced)

1.Interceptor definition

Spring Web MVC's processor interceptor is similar to the filter Filter in Servlet development, which is used to pre-process and post-process the processor.

Define the interceptor and implement the HandlerInterceptor interface. Three methods are provided in the interface.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

<span style="color: #0000ff">package</span><span style="color: #000000"> joanna.yan.ssm.interceptor;

 

</span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.servlet.http.HttpServletRequest;

</span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.servlet.http.HttpServletResponse;

</span><span style="color: #0000ff">import</span><span style="color: #000000"> org.springframework.web.servlet.HandlerInterceptor;

</span><span style="color: #0000ff">import</span><span style="color: #000000"> org.springframework.web.servlet.ModelAndView;

 

</span><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> HandlerInterceptor1 <span style="color: #0000ff">implements</span><span style="color: #000000"> HandlerInterceptor{

 

    </span><span style="color: #008000">//</span><span style="color: #008000">执行Handler完成执行此方法

    </span><span style="color: #008000">//</span><span style="color: #008000">应用场景:统一异常处理,统一日志处理</span>

<span style="color: #000000">    @Override

    </span><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span><span style="color: #000000"> afterCompletion(HttpServletRequest request,

            HttpServletResponse response, Object handler, Exception ex)

            </span><span style="color: #0000ff">throws</span><span style="color: #000000"> Exception {

        System.out.println(</span>"HandlerInterceptor1......afterCompletion"<span style="color: #000000">);

    }

 

    </span><span style="color: #008000">//</span><span style="color: #008000">进入Handler方法之后,返回modelAndView之前执行

    </span><span style="color: #008000">//</span><span style="color: #008000">应用场景从modelAndView出发:将公用的模型数据(比如菜单导航)在这里传到视图,也可以在这里同意指定视图</span>

<span style="color: #000000">    @Override

    </span><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span><span style="color: #000000"> postHandle(HttpServletRequest request, HttpServletResponse response,

            Object handler, ModelAndView modelAndView) </span><span style="color: #0000ff">throws</span><span style="color: #000000"> Exception {

        System.out.println(</span>"HandlerInterceptor1......postHandle"<span style="color: #000000">);

    }

 

    </span><span style="color: #008000">//</span><span style="color: #008000">进入Handler方法之前执行

    </span><span style="color: #008000">//</span><span style="color: #008000">用于身份认证、身份授权

    </span><span style="color: #008000">//</span><span style="color: #008000">比如身份认证,如果认证不通过表示当前用户没有登录,需要此方法拦截不再向下执行。</span>

<span style="color: #000000">    @Override

    </span><span style="color: #0000ff">public</span> <span style="color: #0000ff">boolean</span><span style="color: #000000"> preHandle(HttpServletRequest request, HttpServletResponse response,

            Object handler) </span><span style="color: #0000ff">throws</span><span style="color: #000000"> Exception {

        System.out.println(</span>"HandlerInterceptor1......preHandle"<span style="color: #000000">);

        </span><span style="color: #008000">//</span><span style="color: #008000">return false表示拦截,不向下执行

        </span><span style="color: #008000">//</span><span style="color: #008000">return true表示放行</span>

        <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span><span style="color: #000000">;

    }

 

}</span>

Copy after login

2.Interceptor configuration

There is a large interceptor chain in struts. It is a common thing. You can add it to any action link and let it intercept. But spring's interceptor is not global.

2.1 Configure an interceptor for a certain mapping

The springmvc interceptor performs interception settings for HandlerMapping. If interception is set in a HandlerMapping, the handler that is successfully mapped by the HandlerMapping will eventually use the interceptor.

1

2

3

4

5

6

7

8

9

10

11

<span style="color: #0000ff"><</span><span style="color: #800000">bean

    </span><span style="color: #ff0000">class</span><span style="color: #0000ff">="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"</span><span style="color: #0000ff">></span>

    <span style="color: #0000ff"><</span><span style="color: #800000">property </span><span style="color: #ff0000">name</span><span style="color: #0000ff">="interceptors"</span><span style="color: #0000ff">></span>

        <span style="color: #0000ff"><</span><span style="color: #800000">list</span><span style="color: #0000ff">></span>

            <span style="color: #0000ff"><</span><span style="color: #800000">ref </span><span style="color: #ff0000">bean</span><span style="color: #0000ff">="handlerInterceptor1"</span><span style="color: #0000ff">/></span>

            <span style="color: #0000ff"><</span><span style="color: #800000">ref </span><span style="color: #ff0000">bean</span><span style="color: #0000ff">="handlerInterceptor2"</span><span style="color: #0000ff">/></span>

        <span style="color: #0000ff"></</span><span style="color: #800000">list</span><span style="color: #0000ff">></span>

    <span style="color: #0000ff"></</span><span style="color: #800000">property</span><span style="color: #0000ff">></span>

<span style="color: #0000ff"></</span><span style="color: #800000">bean</span><span style="color: #0000ff">></span>

    <span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="handlerInterceptor1"</span><span style="color: #ff0000"> class</span><span style="color: #0000ff">="joanna.yan.ssm.interceptor.HandlerInterceptor1"</span><span style="color: #0000ff">/></span>

    <span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">id</span><span style="color: #0000ff">="handlerInterceptor2"</span><span style="color: #ff0000"> class</span><span style="color: #0000ff">="joanna.yan.ssm.interceptor.HandlerInterceptor2"</span><span style="color: #0000ff">/></span>

Copy after login

Generally not recommended.

2.2 Configure global interceptors for all mappings

springmvc can configure similar global interceptors, and the springmvc framework injects the configured global-like interceptors into each HandlerMapping.

1

2

3

4

5

6

7

8

9

10

11

12

13

<span style="color: #008000"><!--</span><span style="color: #008000">拦截器 </span><span style="color: #008000">--></span>

<span style="color: #0000ff"><</span><span style="color: #800000">mvc:interceptors</span><span style="color: #0000ff">></span>

    <span style="color: #008000"><!--</span><span style="color: #008000">多个拦截器,顺序执行 </span><span style="color: #008000">--></span>

    <span style="color: #0000ff"><</span><span style="color: #800000">mvc:interceptor</span><span style="color: #0000ff">></span>

        <span style="color: #008000"><!--</span><span style="color: #008000"> /**表示所有url包括子url路径 </span><span style="color: #008000">--></span>

        <span style="color: #0000ff"><</span><span style="color: #800000">mvc:mapping </span><span style="color: #ff0000">path</span><span style="color: #0000ff">="/**"</span><span style="color: #0000ff">/></span>

        <span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">class</span><span style="color: #0000ff">="joanna.yan.ssm.interceptor.HandlerInterceptor1"</span><span style="color: #0000ff">></</span><span style="color: #800000">bean</span><span style="color: #0000ff">></span>

    <span style="color: #0000ff"></</span><span style="color: #800000">mvc:interceptor</span><span style="color: #0000ff">></span>

    <span style="color: #0000ff"><</span><span style="color: #800000">mvc:interceptor</span><span style="color: #0000ff">></span>

        <span style="color: #0000ff"><</span><span style="color: #800000">mvc:mapping </span><span style="color: #ff0000">path</span><span style="color: #0000ff">="/**"</span><span style="color: #0000ff">/></span>

        <span style="color: #0000ff"><</span><span style="color: #800000">bean </span><span style="color: #ff0000">class</span><span style="color: #0000ff">="joanna.yan.ssm.interceptor.HandlerInterceptor2"</span><span style="color: #0000ff">></</span><span style="color: #800000">bean</span><span style="color: #0000ff">></span>

    <span style="color: #0000ff"></</span><span style="color: #800000">mvc:interceptor</span><span style="color: #0000ff">></span>

<span style="color: #0000ff"></</span><span style="color: #800000">mvc:interceptors</span><span style="color: #0000ff">></span>

Copy after login

3.Interception test

3.1 Testing requirements

Test the execution timing of each method of multiple interceptors.

3.2Write two interceptors

3.3 Both interceptors are allowed

Run log information:

1

2

3

4

5

6

7

8

<span style="color: #000000">HandlerInterceptor1...preHandle

HandlerInterceptor2...preHandle

 

HandlerInterceptor2...postHandle

HandlerInterceptor1...postHandle

 

HandlerInterceptor2...afterCompletion

HandlerInterceptor1...afterCompletion</span>

Copy after login

Summarize:

The preHandle method is executed in order, and postHandle and afterCompletion are executed in the reverse order of the interceptor configuration.

3.4 Interceptor 1 is allowed, Interceptor 2 is not allowed

Run log information:

1

2

3

<span style="color: #000000">HandlerInterceptor1...preHandle

HandlerInterceptor2...preHandle

HandlerInterceptor1...afterCompletion</span>

Copy after login

Summarize:

Interceptor 1 is released, and the preHandle of interceptor 2 will be executed.

The preHandle of interceptor 2 will not be released, and the postHandle and afterCompletion of interceptor 2 will not be executed.

As long as there is an interceptor that does not release, postHandle will not be executed.

3.5 Interceptor 1 is not allowed, Interceptor 2 is not allowed

Run log information:

1

HandlerInterceptor1...preHandle

Copy after login

The preHandle of interceptor 1 is not released, and postHandle and afterCompletion will not be executed.

The preHandle of interceptor 1 is not released, and interceptor 2 is not executed.

4. Summary

Apply the interceptor based on the test results.

For example: Unified log processing interceptor, if the interceptor preHandle needs to be changed, it must be released and placed at the first position in the interceptor chain.

For example: login authentication interceptor, placed at the first position in the interceptor chain. The permission verification interceptor is placed after the login interceptor. (Because the permissions are verified after the login is passed)

5.Interceptor application (implementing login authentication)

5.1 Requirements

(1) User request url

(2) Interceptor performs interception verification

If the requested URL is a public address (a URL that can be accessed without logging in), let it pass

If the user session does not exist, jump to the login page.

If the user session exists, release it and continue the operation.

5.2 Login and exit controller methods

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

<span style="color: #0000ff">package</span><span style="color: #000000"> joanna.yan.ssm.controller;

 

</span><span style="color: #0000ff">import</span><span style="color: #000000"> javax.servlet.http.HttpSession;

</span><span style="color: #0000ff">import</span><span style="color: #000000"> org.springframework.stereotype.Controller;

</span><span style="color: #0000ff">import</span><span style="color: #000000"> org.springframework.web.bind.annotation.RequestMapping;

 

@Controller

</span><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span><span style="color: #000000"> LoginController {

     

    </span><span style="color: #008000">//</span><span style="color: #008000">登录</span>

    @RequestMapping("/login"<span style="color: #000000">)

    </span><span style="color: #0000ff">public</span> String login(HttpSession session, String username, String password) <span style="color: #0000ff">throws</span><span style="color: #000000"> Exception{

        </span><span style="color: #008000">//</span><span style="color: #008000">调用service进行用户身份认证

        </span><span style="color: #008000">//</span><span style="color: #008000">...

         

        </span><span style="color: #008000">//</span><span style="color: #008000">在session中保存用户身份信息</span>

        session.setAttribute("username"<span style="color: #000000">, username);

        </span><span style="color: #0000ff">return</span> "redirect:items/queryItems.action"<span style="color: #000000">;

    }

     

    </span><span style="color: #008000">//</span><span style="color: #008000">退出</span>

    @RequestMapping("/logout"<span style="color: #000000">)

    </span><span style="color: #0000ff">public</span> String logout(HttpSession session) <span style="color: #0000ff">throws</span><span style="color: #000000"> Exception{

        </span><span style="color: #008000">//</span><span style="color: #008000">清除session</span>

<span style="color: #000000">        session.invalidate();

        </span><span style="color: #0000ff">return</span> "redirect:items/queryItems.action"<span style="color: #000000">;

    }

     

}</span>

Copy after login

5.3 Login authentication interception implementation

5.3.1LoginInterceptor

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

<span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> LoginInterceptor <span style="color: #0000ff">implements</span><span style="color: #000000"> HandlerInterceptor{

 

    </span><span style="color: #008000">//</span><span style="color: #008000">执行Handler完成执行此方法

    </span><span style="color: #008000">//</span><span style="color: #008000">应用场景:统一异常处理,统一日志处理</span>

<span style="color: #000000">    @Override

    </span><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span><span style="color: #000000"> afterCompletion(HttpServletRequest request,

            HttpServletResponse response, Object handler, Exception ex)

            </span><span style="color: #0000ff">throws</span><span style="color: #000000"> Exception {

        System.out.println(</span>"HandlerInterceptor1......afterCompletion"<span style="color: #000000">);

    }

 

    </span><span style="color: #008000">//</span><span style="color: #008000">进入Handler方法之后,返回modelAndView之前执行

    </span><span style="color: #008000">//</span><span style="color: #008000">应用场景从modelAndView出发:将公用的模型数据(比如菜单导航)在这里传到视图,也可以在这里同意指定视图</span>

<span style="color: #000000">    @Override

    </span><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span><span style="color: #000000"> postHandle(HttpServletRequest request, HttpServletResponse response,

            Object handler, ModelAndView modelAndView) </span><span style="color: #0000ff">throws</span><span style="color: #000000"> Exception {

        System.out.println(</span>"HandlerInterceptor1......postHandle"<span style="color: #000000">);

    }

 

    </span><span style="color: #008000">//</span><span style="color: #008000">进入Handler方法之前执行

    </span><span style="color: #008000">//</span><span style="color: #008000">用于身份认证、身份授权

    </span><span style="color: #008000">//</span><span style="color: #008000">比如身份认证,如果认证不通过表示当前用户没有登录,需要此方法拦截不再向下执行。</span>

<span style="color: #000000">    @Override

    </span><span style="color: #0000ff">public</span> <span style="color: #0000ff">boolean</span><span style="color: #000000"> preHandle(HttpServletRequest request, HttpServletResponse response,

            Object handler) </span><span style="color: #0000ff">throws</span><span style="color: #000000"> Exception {

        System.out.println(</span>"HandlerInterceptor1......preHandle"<span style="color: #000000">);

        </span><span style="color: #008000">//</span><span style="color: #008000">获取请求的url</span>

        String url=<span style="color: #000000">request.getRequestURI();

        </span><span style="color: #008000">//</span><span style="color: #008000">判断url是否是公开地址(实际使用时要将公开地址配置到文件中)

        </span><span style="color: #008000">//</span><span style="color: #008000">这里公开地址是登录提交的地址</span>

        <span style="color: #0000ff">if</span>(url.indexOf("login.action")>=0<span style="color: #000000">){

            </span><span style="color: #008000">//</span><span style="color: #008000">如果进行登录提交,放行</span>

            <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span><span style="color: #000000">;

        }

        </span><span style="color: #008000">//</span><span style="color: #008000">判断session</span>

        HttpSession session=<span style="color: #000000">request.getSession();

        String username</span>=(String) session.getAttribute("username"<span style="color: #000000">);

        </span><span style="color: #0000ff">if</span>(username!=<span style="color: #0000ff">null</span><span style="color: #000000">){

            </span><span style="color: #008000">//</span><span style="color: #008000">身份存在,放行</span>

            <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span><span style="color: #000000">;

        }

         

        </span><span style="color: #008000">//</span><span style="color: #008000">执行到这里,表示用户身份需要认证,跳转登录页面</span>

        request.getRequestDispatcher("/WEB-INF/jsp/login.jsp"<span style="color: #000000">).forward(request, response);

         

        </span><span style="color: #008000">//</span><span style="color: #008000">return false表示拦截,不向下执行

        </span><span style="color: #008000">//</span><span style="color: #008000">return true表示放行</span>

        <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span><span style="color: #000000">;

    }

 

}</span>

Copy after login

5.3.2 Interceptor configuration

Configuration in springmvc.xml under classpath:

If this article is helpful to you, please tip me on WeChat~

The above is the detailed content of Spring+SpringMVC+MyBatis in-depth learning and construction (17) - SpringMVC interceptor. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1247
24
How to quickly build a statistical chart system under the Vue framework How to quickly build a statistical chart system under the Vue framework Aug 21, 2023 pm 05:48 PM

How to quickly build a statistical chart system under the Vue framework. In modern web applications, statistical charts are an essential component. As a popular front-end framework, Vue.js provides many convenient tools and components that can help us quickly build a statistical chart system. This article will introduce how to use the Vue framework and some plug-ins to build a simple statistical chart system. First, we need to prepare a Vue.js development environment, including installing Vue scaffolding and some related plug-ins. Execute the following command in the command line

Can buildings be built in the wild in Mistlock Kingdom? Can buildings be built in the wild in Mistlock Kingdom? Mar 07, 2024 pm 08:28 PM

Players can collect different materials to build buildings when playing in the Mistlock Kingdom. Many players want to know whether to build buildings in the wild. Buildings cannot be built in the wild in the Mistlock Kingdom. They must be within the scope of the altar. . Can buildings be built in the wild in Mistlock Kingdom? Answer: No. 1. Buildings cannot be built in the wild areas of the Mist Lock Kingdom. 2. The building must be built within the scope of the altar. 3. Players can place the Spirit Fire Altar by themselves, but once they leave the range, they will not be able to construct buildings. 4. We can also directly dig a hole in the mountain as our home, so we don’t need to consume building materials. 5. There is a comfort mechanism in the buildings built by players themselves, that is to say, the better the interior, the higher the comfort. 6. High comfort will bring attribute bonuses to players, such as

Best practices and precautions for building a web server under CentOS 7 Best practices and precautions for building a web server under CentOS 7 Aug 25, 2023 pm 11:33 PM

Best practices and precautions for building web servers under CentOS7 Introduction: In today's Internet era, web servers are one of the core components for building and hosting websites. CentOS7 is a powerful Linux distribution widely used in server environments. This article will explore the best practices and considerations for building a web server on CentOS7, and provide some code examples to help you better understand. 1. Install Apache HTTP server Apache is the most widely used w

Quickly install PyTorch in PyCharm: an easy guide Quickly install PyTorch in PyCharm: an easy guide Feb 24, 2024 pm 09:54 PM

PyTorch Installation Guide: Quickly set up a development environment in PyCharm PyTorch is one of the most popular frameworks in the current field of deep learning. It has the characteristics of ease of use and flexibility, and is favored by developers. This article will introduce how to quickly set up the PyTorch development environment in PyCharm, so that you can start the development of deep learning projects. Step 1: Install PyTorch First, we need to install PyTorch. The installation of PyTorch usually needs to take into account the system environment

What's the best way to set up a Douyin account? What is the five-piece account creation kit? What's the best way to set up a Douyin account? What is the five-piece account creation kit? Apr 02, 2024 am 09:52 AM

With the rapid development of mobile Internet, the short video application Douyin has become an indispensable part of people's daily lives. Having a popular Douyin account can not only attract the attention of fans, but also bring commercial value. So, how to set up the best Douyin account? 1. What is the best way to set up a Douyin account? 1. Clear positioning When creating a Douyin account, you must first clarify your positioning. Do you want to be a funny joker or a professional knowledge sharer? Clear positioning can help attract precise fans, thereby increasing the value of your account. 2. Account naming: A good account name can make fans remember you at a glance. The account name should be concise and clear, related to your positioning, and have a certain degree of creativity. Avoid using names that are too common to avoid confusion with others

How to build an account matrix? What are the functions of matrix construction? How to build an account matrix? What are the functions of matrix construction? Mar 23, 2024 pm 06:46 PM

In today's information-rich era, social media platforms have become the main way for people to obtain and share information. For individuals and enterprises, establishing an effective account network to achieve maximum dissemination of information and enhance influence has become an urgent challenge that needs to be solved. 1. How to build an account matrix? 1. Clarify the target audience. Before building an account matrix, the key is to clearly define the target audience and gain an in-depth understanding of their needs, interests, and consumption habits, so that a more targeted content strategy can be developed. 2. Choose the appropriate platform. According to the characteristics of the target group, choose the appropriate social media platform for layout. Currently, the mainstream social media platforms include Weibo, WeChat, Douyin, Kuaishou, etc. Each platform has its own unique user groups and communication characteristics, and the selection needs to be based on the actual situation.

Network security reinforcement techniques for building web servers under CentOS 7 Network security reinforcement techniques for building web servers under CentOS 7 Aug 05, 2023 pm 01:12 PM

Network security reinforcement techniques for building web servers under CentOS7 The web server is an important part of the modern Internet, so it is very important to protect the security of the web server. By hardening network security, you can reduce risks and avoid potential attacks. This article will introduce network security reinforcement techniques commonly used when building web servers on CentOS7, and provide corresponding code examples. Update your system and software First, make sure your system and software are up to date. You can use the following command to update

How to build a simple file management system using Node.js How to build a simple file management system using Node.js Nov 08, 2023 pm 06:19 PM

Node.js is a very popular server-side running environment. It is written in JavaScript and allows developers to use the same programming language for front-end and back-end development. The efficiency and flexibility of Node.js make it an important part of web development. In this article, we will learn how to use Node.js to build a simple file management system. In order to achieve this function, we need to use the basic modules fs (filesystem) and h of Node.js

See all articles