🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# go语言框架Gin 安装gin ``` <pre class="calibre14">``` go get <span class="token">-</span>u <span class="token">-</span>v github<span class="token2">.</span>com<span class="token">/</span>gin<span class="token">-</span>gonic<span class="token">/</span>gin ``` ``` 在目录src下创建main.go ``` <pre class="calibre16">``` package main import <span class="token4">"github.com/gin-gonic/gin"</span> func <span class="token1">main</span><span class="token2">(</span><span class="token2">)</span> <span class="token2">{</span> r <span class="token2">:</span><span class="token">=</span> gin<span class="token2">.</span><span class="token1">Default</span><span class="token2">(</span><span class="token2">)</span> r<span class="token2">.</span><span class="token1">GET</span><span class="token2">(</span><span class="token4">"/"</span><span class="token2">,</span> <span class="token1">func</span><span class="token2">(</span>c <span class="token">*</span>gin<span class="token2">.</span>Context<span class="token2">)</span> <span class="token2">{</span> c<span class="token2">.</span><span class="token1">String</span><span class="token2">(</span><span class="token3">200</span><span class="token2">,</span> <span class="token4">"Hello, 你好吗"</span><span class="token2">)</span> <span class="token2">}</span><span class="token2">)</span> r<span class="token2">.</span><span class="token1">Run</span><span class="token2">(</span><span class="token4">":8888"</span><span class="token2">)</span> <span class="token2">}</span> ``` ```