How to quickly have a Web IDE

Install Web IDEs

Download and install tool

On the server, execute the following command:

# download

wget https://github.com/ErikXu/power-ci/releases/download/0.1.1/power-ci.tar.gz

 

# unzip

tar -xzvf power-ci.tar.gz

 

# Setting permissions

chmod +x power-ci

Install Web IDEs

Execute the following command to install Web IDE:

./power-ci code-server install

Install Golang

Execute the following command to install Golang:

./power-ci go install

# Set environment variables

source ~/.bashrc

Using Web IDEs

Start Web IDE

Execute the following command to start WebIDE and obtain the login password:

./power-ci code-server start

Login to Web IDE

Open the Web IDE with a browser:

Enter password to log in:

Open a terminal:

Create a demo directory with the following command:

mkdir demo

Open the demo directory:

Install the go extension:

Initialize the go project with the following command:

go mod init demo

Add main.go file and install go extension dependencies:

Improve the content of the main.go file, the example is the hello world program of gin:

package main

 

import (

  "net/http"

 

  "github.com/gin-gonic/gin"

)

 

func main() {

  r := gin.Default()

  r.GET("/ping", func(c *gin.Context) {

    c.JSON(http.StatusOK, gin.H{

      "message": "pong",

    })

  })

  r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")

}

Download dependencies using the following command:

go mod tidy

Run the program with the following command:

go run main.go

Browser access:

Use http://0.0.0.0:8080/ping to access, where 0.0.0.0 is the current server IP

 

project address

 

At present, it is planned to maintain two versions of golang and .Net. If you think it is easy to use, please click a star. Feedback and suggestions are also welcome to raise issues. If you want to do open source projects together, you can also leave a message or submit a pr.

golang version

https://github.com/ErikXu/power-ci

 

.Net version

https://github.com/ErikXu/PowerCI.Net

 

 

 

 

 

 

 

 

Comments

You must be logged in to post a comment.

About Author

This guy is lazy and left nothing behind.