ntc-gfiber

command module
v0.0.0-...-6f82975 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

ntc-gfiber

ntc-gfiber is an example golang http server using Fiber

Quick start

# install library dependencies
#make deps
export GO111MODULE=on
go mod tidy

# build
make build

# start mode development
make run

# clean build
make clean

Call API Post

Add New Post
curl -X POST -i 'http://127.0.0.1:8080/post' \
  -H "Content-Type: application/json" \
  --data '{
    "title": "title1",
    "body": "body1"
  }'
Update Post
curl -X PUT -i 'http://127.0.0.1:8080/post' \
  -H "Content-Type: application/json" \
  --data '{
    "id": 1,
    "title": "title1 update",
    "body": "body1 update"
  }'
Get Post
# Get a post
curl -X GET -H 'Content-Type: application/json' \
  -i 'http://127.0.0.1:8080/post/1'

# Get slide posts
curl -X GET -H 'Content-Type: application/json' \
  -i 'http://127.0.0.1:8080/posts?page=1'
Delete Post
curl -X DELETE -H 'Content-Type: application/json' \
  -i 'http://127.0.0.1:8080/post/1'

Call API Tag

Add New Tag
curl -X POST -i 'http://127.0.0.1:8080/tag' \
  -H "Content-Type: application/json" \
  --data '{
    "name": "tag1"
  }'
Update Tag
curl -X PUT -i 'http://127.0.0.1:8080/tag' \
  -H "Content-Type: application/json" \
  --data '{
    "id": "5ff379a2669ad8ac6d1addc1",
    "name": "tag1 update"
  }'
Get Tag
# Get a tag
curl -X GET -H 'Content-Type: application/json' \
  -i 'http://127.0.0.1:8080/tag/5ff379a2669ad8ac6d1addc1'

# Get slide tags
curl -X GET -H 'Content-Type: application/json' \
  -i 'http://127.0.0.1:8080/tags?page=1'
Delete Tag
curl -X DELETE -H 'Content-Type: application/json' \
  -i 'http://127.0.0.1:8080/tag/5ff37b2a669ad8ac6d1addda'

License

This code is under the Apache License v2.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL