We are developing embedded device which will integrate with some of our services in future. This device have limited set of functionalities and user defined mods for particular use cases. Based on arm architecture this device running modified version of Debian. For network and main configuration setup I need to write small web service. This should be secure and light. I tested this with mix of lightweight web servers such as lighttpd and languages like python and manged to get prototype working. which have the functioning web service and that web service can integrate with clients which push the configuration in initial step. My concern is even though this is lightweight I dont need to deploy full featured web server on devices which have high level of access to the device for configure it. even though I disable this process after the configuring

Is there any way to have small rest api other than having full-blown web server ? I already tested restbed C++ rest api. which is complex and python based server less web service. but I don't want to deploy python either. since this service only transmit like below 10 parameters to the client and it's overkill. is there any secure way to implement this without daemon like service.

closed as too broad by muru, msp9011, schily, Archemar, Jeff Schaller Aug 14 '18 at 11:00

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • To do any rest api you will need at least a cgi server. Perhaps one small enough for you in C with https is mini_httpd. You would need to write the "rest" part yourself. There are also Perl solutions, but since you don't want Python that won't do. Perhaps you could start from this simple shell script server or this one. – meuh Aug 13 '18 at 10:05
  • Thanks. I already tested both the solutions you suggest as well as httpd on busybox. I'll try to do this setup with mini httpd. but I'm worried about the permissions those web servers that I need to give for execute high-level systems tasks. At the moment I have configured sudo for specific commands. Is there any proper way to do it securely ?. And also I would thankful if you can suggest good books on this exact area – gripen fighter Aug 14 '18 at 2:55

Although this question is a little vague and open to opinion I'll throw mine out there. Golang Has a very easy to use server package right in the standard library. It looks a lot like C, compiles to native executables on almost any platform and architecture and you can host a very simple webserver with very few lines as in below.

package main

import (

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])

func main() {
    http.HandleFunc("/", handler)
    log.Fatal(http.ListenAndServe(":8080", nil))

If you want security you can very easily set up TLS by creating some self signed certs, and simply replacing the http.ListenAndServe with err := http.ListenAndServeTLS(":10443", "cert.pem", "key.pem", nil)

It's very lightweight and easy to run anywhere. As Eli smartly pointed out in the comments, cross compilation is also very easy to do, meaning quick builds and deploys to your embedded devices.

  • 1
    A big plus for this kind of project is Go's really good cross compiling toolchains. Though if the target system is really memory constrained, the size of Go's rather large static binaries can be an issue. Given that the question mentions using Python successfully that's probably not an issue here. – Eli Heady Aug 14 '18 at 4:28
  • Thanks for the answer. Looks like really interesting. I started to learn . !! – gripen fighter Aug 20 '18 at 3:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.