Giter Club home page Giter Club logo

micro-api's Introduction

Micro-API

Description

This is a inimalistic API written in GO with in-memory storage

Usage

docker run -d --name micro-api -p 8080:8080 -e ADMIN_PASSWORD=admin micro-api

Available endpoints

URL (relative) METHOD REQUEST RESPONSE AUTH RESPONSE COMMENT
/records GET n/a application/json no 200 OK + json list Get all records
/records/$ID GET n/a application/json no 200 OK + json object Get record with id $ID
/records POST application/json n/a no 200 OK Create a new record with payload
/records/random GET n/a application/json no 200 OK + json list Get random record
/admin GET n/a text/plain no 401 Unauthorized Try to access w/o authentication
/admin GET n/a text/html yes (basic-auth) 200 OK + html Access w/ correct authentication

JSON payload format

GET /records - Response:

[
	{
  		"name": "Record 1",
  		"desc": "Description of the first record",
		"id": "1647195672916783205"
	},
	...
]

GET /records/1647195672916783205 - Response:

{
	"name": "Record 1",
	"desc": "Description of the first record",
	"id": "1647195672916783205"
}

GET /records/random - Response:

{
	"name": "Record 1",
	"desc": "Description of the first record",
	"id": "1647195672916783205"
}

POST /records/$ID - Request:

{
	"name": "Record 1",
	"desc": "Description of the first record"
}

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.