Skip to content

A simple HTTP REST API server in different languages

Notifications You must be signed in to change notification settings

begoon/http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP server in different languages

Problem statement

The server listens on localhost:8000 and exposes /version endpoint.

The /version endpoint returns a RESTful JSON response with the "version" fields. The payload should be serialized to JSON from a struct or class, not printed as a simple string.

Other routes, root included, should return 404.

When the server runs, it should respond to curl http://localhost:8000/version or in the web browser.

Used compilers and interpreters

language version source run command
zig 0.14.0 main.zig make zig
rustc 1.82.0 main.rs make rust
swift 6.0 main.swift make swift
go 1.23 main.go make go
d/ldc 1.40 main.d make d
ruby 3.3.6 main.rb make ruby
dart 3.5.4 main.dart make dart
deno 2.0.6 main-deno.ts make deno
bun 1.1.34 main-bun.ts make bun
node 23.1.0 main.js make node
php 8.3.13 main.php make php
python 3.13 main.py make python
pascal/fpc 3.2.2 main.pas make fpc
lua 5.4.7 main.lua make lua
csharp/dotnet 9.0.0 main.cs make cs
perl 5.34.1 main.pl make perl

All implementations above are tested on macOS 15.1 Sequoia.

Run client

make q or curl -q http://localhost:8000/version.

Contributions

C# version is rewritten by @neon-sunset

Swift version is rewritten by @Frizlab

About

A simple HTTP REST API server in different languages

Resources

Stars

Watchers

Forks