Skip to content

emkeyen/go_server_test_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go HTTP Server Integration API Testing

Quick Start

Run Tests

go test ./httpserver -v

Start Server

go run main.go
# Server running on http://localhost:3333

API Endpoints

User CRUD Operations

Create User (POST)

curl -X POST http://localhost:3333/user \
  -H "Content-Type: application/json" \
  -d '{"name":"New User"}'

Get User (GET)

curl "http://localhost:3333/user?id=1"

Update User (PATCH)

curl -X PATCH http://localhost:3333/user \
  -H "Content-Type: application/json" \
  -d '{"id":1,"name":"Updated Name"}'

Delete User (DELETE)

curl -X DELETE "http://localhost:3333/user?id=1"

Utility Endpoints

Root Endpoint

curl http://localhost:3333/

Hello Endpoint

curl http://localhost:3333/hello

Response Codes

Code Description
200 OK
201 Created
204 No Content
400 Bad Request
404 Not Found
405 Method Not Allowed
409 Conflict

About

Simple HTTP Server written in Go for Testing purposes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages