訪問部署在Cloud Studio上的web服務

Cloud Studio工作臺URL映射關係

比如你使用Intellij中的Spring Initializr構建了一個Spring Boot web項目,並且有這樣一個Controller:

@RestController
public class HelloController {
    @RequestMapping("/hello")
    public String index() {
        return "Hello World";
    }
}

當你把該項目部署在本地時,訪問該服務的請求地址爲http://localhost:8080/hello;當你把該項目部署在Cloud Studio工作臺啓動時,要想訪問到該服務,需要先在工作臺右側打開訪問鏈接面板,點擊創建鏈接按鈕,會生成映射到http://localhost:8080鏈接(如https://dsiisv-8080-glzzwx.dev.ide.live),在映射鏈接後追加/hello得到https://dsiisv-8080-glzzwx.dev.ide.live/hello,在瀏覽器中打開該地址就可以訪問到你部署在Cloud Studio的服務了。如圖
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章