What is pure front-end development

First of all, when I say pure front-end here, I mean completely independent of server side development. There is no need to have server side environment locally, no need to run server side code, simply send and receive requests to complete all interactions. As forward-to-back architectures become more popular and pure front-end development becomes more and more common, this article briefly describes how I, as a pure front-end developer, streamlined my environment configuration and worked happily without Nginx and SwitchHosts.

What do Nginx and SwitchHosts do

If we’re going to throw away Nginx and SwitchHosts, we must first ask what these two roles do during our development. Clear requirements, to determine the solution ah ~

Nginx

In pure front-end development, Nginx plays the most role is the reverse proxy, the local development environment proxy to the specified domain name, or the server interface proxy to the specified domain name, in order to solve cross-domain and shared cookies and other problems.

SwitchHosts

This is relatively simple, is convenient to manage the local hosts, quickly switch, quickly enable and disable, nothing good to talk about.

Zan Proxy

After comparing the apps, I choseZan Proxy.Click me direct to the official website 在Zan ProxyYou can configure Hosts, set Http forwarding, customize mock data, monitor requests… The reverse proxy corresponding to Nginx is availableHttp forwardTo achieve, and its visual interface and rich functionality, is simply more than a few orders of magnitude better than Nginx.You can manage the hosts file corresponding to SwitchHostsHosts managementTo implement, personal feeling and SwitchHosts use similar feelings, not superior points, but since it has been usedZan Proxy, you can retire SwitchHostsSince then, both of our needs have been addressed. Why not use them? !

Besides Nginx and SwitchHosts, what else can you throw away

Read carefullyZan ProxyI found that I could throw away not just the two tools above,Mock server,CharlesYou can almost throw it away. There are many more uses waiting to be discovered.

summary

There are other solutions such as Easy Mock + Proxy, but as a very lazy front end who doesn’t want to focus on environment configuration, I prefer the one-click fool solution with all the functionality. However, this scheme also has some inconvenient places, such as I have to start a terminal to continue to run the Service, all configuration modifications need to call a web page, more hope to make a background Service, and then through the App to operate, was thrown away SwitchHosts is a good learning object. At present, the scheme has submitted an issue to the author, and the reply says that it will be considered.

!!!!!!!!! Disclaiming: This article is intended only to be used by the author in the development process. It is not intended to denigrate Nginx, SwitchHosts, Mock Server, Charles, or any other application. The pictures in this article are quoted from Zan Proxy’s official website. If there is any infringement, please contact me to delete them.