Not only should web developers know how to launch a local HTTP server, but it's also useful for mobile developers as well. For example, we might want to check the network layer of our mobile app and parse the response to our models while the backend part is still under development. DTO There are many useful solutions for these tasks (such as or ). However, in this article, we are going to build our own solution! 🤓💪 mockoon postman To launch the local webserver, we can use Debian or macOS. In this tutorial, I will use , though the vast majority of the listed commands are also applicable to the macOS ecosystem. Debian on Windows through WSL If you have already installed Debian OS, we also need to install a python interpreter (This procedure is not required for macOS users because macOS already has a python interpreter). We can do this via this command: apt install python3 $sudo If you are using Debian for this tutorial, you might need to install a terminal multiplexer to make further work more convenient: apt install tmux install tmux ( the macOS users) $sudo $brew for Once these operations are finished, you can launch the webserver through the command listed below. For the Debian users, we should start a new session with this command: tmux new-session -s testname $tmux And now, we can create a separate terminal to debug our server. We can do this using hotkey and right after that - press (I know that's a weird hotkey 🤯). CTRL+B % This will create a new terminal on the right side. In macOS, you can create a new terminal window via hotkey. CMD+N You can also navigate through sessions using hotkey. tmux CTRL+left key/right key Then create a folder named “server” and change the directory to this newly created folder: server server $mkdir $cd Right after that, we need to create a file that will be sent to our mobile app whenever requested. Let’s create this json file with json nano/vim : teachers.json $nano and paste this content: { : , : [ { : , : , : }, { : , : , : } ]} "success" true "body" "id" "1" "first_name" "Julia" "last_name" "Green" "id" "2" "first_name" "Peter" "last_name" "Sheppard" For macOS users: You can just create a json file with any existing text editor in the newly created folder. So now, let’s launch the webserver in this folder. At the left terminal, run this command: -m http.server $python3 If the default port for this python webserver (8000) is not occupied by another process, then the launching process should be finished successfully. Otherwise, you can provide a different port like this: -m http.server 8052 $python3 The last thing we need to do on our “backend” side is to verify the reachability of our service. First of all, we need to get our server’s local IP address. You can find it in the command for Debian or for macOS. My server’s local IP address is so now I can switch to another device, open a browser and enter the following URL: ip address ifconfig 192.168.1.53, http://192.168.1.53:8000/teachers.json Or you can test it through on the right side of the session. Telnet also can be installed with this command: telnet tmux install telnet install telnet ( macOS) $apt $brew for As you can see here, I am sending a common HTTP request on the left session, and as a result, you can see the response on the right side! GET The last thing is to make sure you can get the response from our iOS app. So, let’s create a new Xcode project, and in file, enter the following code: AppDelegate.swift -> { components = () components.scheme = components.host = components.port = components.path = url = components.url { .shared.dataTask(with: url) { data, response, error error = error { (error) } data = data, jsonResponse = ? .jsonObject(with: data, options: .allowFragments) { (jsonResponse) } }.resume() } } func application ( application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: ]?) _ Any Bool var URLComponents "http" "192.168.1.53" 8000 "/teachers.json" // Which finally brings us http://192.168.1.53:8000/teachers.json if let URLSession in if let print else if let let try JSONSerialization print return true Let’s start the app and see the result… And that’s it! We finally got the response from our local server! 🎉🎉🎉 Now we can continue our development process with these mocks, and when the real server side is ready, we can just replace our endpoints!🙂