davewhit3 / std-server

Dummy Golang server based on routing from version 1.22 features

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

std-server

User management API

Getting started

Requirements

Setup

Set environments from .env.dist file

Develop

How to run?

Local:

make run

Docker:

docker run --rm -w /app -v `pwd`:/app -p 8080:8080 golang:1.22.0 make run

Tests

make test

Coverage

make coverage

Build

make build

Users management

User model:

{
  "id": 1,
  "first_name": "Dave",
  "last_name": "White",
  "email": "dave@white.com"
}

Example of creating a user

curl -X POST http://localhost:8080/users -d '{"first_name":"Dave", "last_name": "White", "email": "dave@white.com"}'
Method URL Description
GET /users Retrieve all users.
POST /users Create a new user.
GET /users/1 Retrieve user #1.
PUT /users/1 Update data in user #1.
DELETE /users/1 Delete user #1.

Server helpers

Method URL Description
GET /health Server health
GET /ready Server ready
GET /metrics Server metrics

About

Dummy Golang server based on routing from version 1.22 features

License:GNU General Public License v3.0


Languages

Language:Go 96.8%Language:Makefile 3.2%