ntc-gfastserver

command module
v0.0.0-...-aa5fa10 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

ntc-gfastserver

ntc-gfastserver is an example golang http server using fasthttp

Quick start

# install library dependencies
#make deps
go mod download

# update go.mod file
go mod tidy

# build
export GO111MODULE=on
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