[英]How to access a localhost server from one computer to another on the same network
I have a spring boot application (Spring Web) which has a tomcat server embedded into it (maven dependency). 我有一个Spring Boot应用程序(Spring Web),其中嵌入了一个tomcat服务器(maven依赖项)。 The application is a server and consists of several HTTP routes. 该应用程序是一台服务器,由几个HTTP路由组成。 This application is on my laptop. 该应用程序在我的笔记本电脑上。 I would like to execute the application on my laptop, and be able to RESTful calls (eg GET, POST etc) to the server. 我想在笔记本电脑上执行该应用程序,并能够对服务器进行RESTful调用(例如GET,POST等)。 How can I make requests to the server from my computer? 如何从计算机向服务器发出请求?
I've checked out several tutorials and they tend to use XAMP or another similar application so not sure on how to go about this. 我已经检查了几个教程,他们倾向于使用XAMP或其他类似的应用程序,所以不确定如何去做。 Thank you. 谢谢。
Once your war is deployed on your server, you can send any REST call to it using curl, a browser, or my personal favorite for testing is Postman as it circumvents cross-domain issues. 一旦您的战争部署在服务器上,您就可以使用curl,浏览器或我个人最喜欢测试的REST呼叫来发送任何REST呼叫,因为Postman可以绕过跨域问题。
To make the REST call simply use the IP address of the server instead of localhost. 要进行REST调用,只需使用服务器的IP地址而不是localhost。 You can get the IP address of the machine using ifconfig or whatsmyip.org 您可以使用ifconfig或whatsmyip.org获取计算机的IP地址。
http://<IP address>/...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.