Giter Site home page Giter Site logo

assetfindr-test's Introduction

AssetFindr Test

Posts and tags application

summary

this application is created with go, gin, gorm and postgres sql. it also follows base practice for creating simple api,error handling, testing, and mocking.

installation

to run the stacks, the project needs to create .env file, you can copy from example.env.

and run the docker compose, please make sure you install the docker and make

make stack-up

to run the application need to run the go, please make sure you install the go language

make run-http

and application ready to serve in desired port

List of API

this projects is using http api

1. get list of post

to get list of post

GET {{API_ENDPOINT}}/api/posts

can be invoked with

curl --location 'http://{{API_ENDPOINT}}/api/posts'

and the response will look like this

{
    "data": [
        {
            "id": 86,
            "title": "a",
            "content": "a",
            "tags": [
                "v",
                "b"
            ]
        },
        {
            "id": 85,
            "title": "f",
            "content": "g",
            "tags": [
                "h",
                "i"
            ]
        }
    ],
    "result": "ok"
}

2. get post by id

to get 1 post by id

GET {{API_ENDPOINT}}/api/posts/1

can be invoked with

curl --location 'http://{{API_ENDPOINT}}/api/posts/1'

and the response will look like this

{
    "data": {
        "id": 76,
        "title": "Lorem 12",
        "content": "a",
        "tags": [
            "Lorema",
            "a"
        ]
    },
    "result": "ok"
}

3. create post

to create post by id

POST {{API_ENDPOINT}}/api/posts

can be invoked with

curl --location 'http://{{API_ENDPOINT}}/api/posts' \
--header 'Content-Type: application/json' \
--data '{
 "title": "Lorem",
"content": "test",
 "tags":["ipsum"]
}'

and the response will look like this

{
    "result": "created"
}

4. update post

to update post by id

PUT {{API_ENDPOINT}}/api/posts/1

can be invoked with

curl --location --request PUT 'http://{{API_ENDPOINT}}/api/posts/86' \
--header 'Content-Type: application/json' \
--data '{
 "title": "Upda",
 "content": "Upda",
 "tags": [ "Ipsum1000", "ac"]
}'

and the response will look like this

{
    "result": "updated"
}

5. delete post

to delete post by id

DELETE {{API_ENDPOINT}}/api/posts/1

can be invoked with

curl --location --request DELETE 'http://{{API_ENDPOINT}}/api/posts/86' \
--header 'Content-Type: application/json' \

and the response will look like this

{
    "result": "deleted"
}

assetfindr-test's People

Contributors

elangreza14 avatar

Watchers

 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.