GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SayHelloLexa/Books-API: Пример простого API для работы с БД (имитация - слайс структур book) книг

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
cmd
cmd
 
 
pkg/api
pkg/api
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
readme.md
readme.md
 
 

Repository files navigation

Пример простого REST API

app.go - пример приложения, использующее API

package main

import (
	"log"
	"net/http"

	h "github.com/sayhellolexa/api-example/pkg/api"
)

func main() {
	a := h.New()

	*a.Books = append(*a.Books, h.Book{
		ID:    "1",
		Title: "Властелин колец",
		Author: &h.Author{
			Firstname: "Джон",
			Lastname:  "Толкин",
		},
	})

	*a.Books = append(*a.Books, h.Book{
		ID:    "2",
		Title: "Преступление и наказание",
		Author: &h.Author{
			Firstname: "Федор",
			Lastname:  "Достоевский",
		},
	})

	log.Println("Сервер слушает :8080...")
	http.ListenAndServe(":8080", a.Router)
}

About

Пример простого API для работы с БД (имитация - слайс структур book) книг

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.