고랭지농업

Fiber로 간단하게 HTTP 서버 생성하기

· 3년 전 · 1049

터미널 ->

[code]

go mod init example/sir-http

[/code]

 

[code]

go get github.com/gofiber/fiber/v2

[/code]

 

/main.go

[code]

package main

 

import "github.com/gofiber/fiber/v2"

 

func main() {

    // 설정

    config := fiber.Config{

        AppName: "App"

    }

   

    // 인스턴스 생성

    app := fiber.New(config)

 

    // 라우트

    app.Get("/", func(c *fiber.Ctx) error {

        return c.SendString("Hello World")

    })

 

    // 서버 시작

    app.Listen(":3000")

}

[/code]

 

|
댓글을 작성하시려면 로그인이 필요합니다.

Golang

+
제목 글쓴이 날짜 조회
2년 전 조회 509
2년 전 조회 1,181
2년 전 조회 541
2년 전 조회 755
2년 전 조회 592
3년 전 조회 901
3년 전 조회 576
3년 전 조회 626
3년 전 조회 634
3년 전 조회 893
3년 전 조회 1,050
3년 전 조회 607
3년 전 조회 908
3년 전 조회 945
3년 전 조회 1,103
4년 전 조회 1,019
4년 전 조회 1,612
4년 전 조회 1,337
4년 전 조회 1,160
4년 전 조회 1,243
4년 전 조회 1,240
4년 전 조회 1,187
4년 전 조회 1,192
4년 전 조회 1,836
5년 전 조회 1,270
5년 전 조회 2,291
5년 전 조회 1,663
5년 전 조회 1,233
6년 전 조회 1,436
6년 전 조회 1,265