Socket
Socket
Sign inDemoInstall

github.com/aiescola/go_shop_api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/aiescola/go_shop_api


Version published
Created
Source

Go Shop Backend

Sample backend project made in Go and used in the android Project: Android Market App Clean Architecture

It's deployed in Heroku, although it uses a free dyno, so the first time it will delay a bit or even timeout.

Register/Login

POST methods require authentication, for it, you must first /register using the appropiate username and password in the body (urlencoded)

As for /login you can either use a POST with the encoded credentials or a GET to fill the credentials in an html form.

Products

GET Products

/api/products
{
    "products": [
        {
            "code": "MUG",
            "name": "Mug",
            "price": 5.4
        },
        {
            "code": "TSHIRT",
            "name": "T-Shirt",
            "price": 12.5
        },
        {
            "code": "PEN",
            "name": "Pen",
            "price": 3.2
        }
    ]
}

GET Product

/api/products/{Code}
{
    "code": "MUG",
    "name": "Mug",
    "price": 5.4
}

POST Product

/api/products/

Raw body:

{ "code": "CODE", "name": "NAME", "price": 99.99 }

Discounts

GET Discounts

/api/discounts/
{
    "discounts": [
        {
            "code": "PRD02",
            "type": "product",
            "name": "One Product discount (voucher)",
            "description": "Mugs at 9.95 for a limited time",
            "productCodes": [
                "MUG"
            ],
            "price": 9.95
        }
    ]
}

GET Discounts

/api/discounts/{code}

{
    "code": "PRD02",
    "type": "product",
    "name": "One Product discount (voucher)",
    "description": "Mugs at 9.95 for a limited time",
    "productCodes": [
        "MUG"
    ],
    "price": 9.95
}

POST Discount

/api/discounts/

Raw body:

{ "code": "TSHIRT", "name": "T-Shirt", "price": 15.90 }

FAQs

Package last updated on 11 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc