Giter VIP home page Giter VIP logo

ntc-gfiber's Introduction

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.

ntc-gfiber's People

Contributors

congnghia0609 avatar

Stargazers

Nathan Barta avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.