Skip to content

ryanhs/cweb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Server (API Apps/application) in pure C

documentation

this web server implement API server with following conditions:

  • use JSON RPC as its API format
  • use thread for its server (http_worker)

and following library:

  • cJSON
  • http-parser

this API using JSON-RPC as data format. please learn it before continue in this documentation. for limit and offset it use same concept as in sql limit and offset

note: please look carefully about data type int or string mean alot.

  • forever start --spinSleepTime 500 -c build/api.run api.sock

example:

  • send
	{
		"jsonrpc": "2.0",
		"method": "school.get", 
		"params": {
			"id": 1
		}, 
		"id": 12131
	}
  • retrieve
	{
		"jsonrpc": "2.0",
		"result": {
			"id": 1,
			"code": 1001,
			"name": "SDN Gegerkalong KPAD",
			"level": "elementary" 
		}, 
		"id": 12131
	}

Util API

just an utility, for ping (checking connection maybe)

ping

  • sent:
    • method: ping
    • params: (no params)
  • receive:
    • string "ok"

example sent:

	{
		"jsonrpc": "2.0",
		"method": "ping", 
		"id": 421321
	}

example retrieve:

	{
		"jsonrpc": "2.0",
		"result": "ok", 
		"id": 421321
	}

author:

License:

MIT License

About

Web Server (application) with pure C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published