# A 8.5kB Nashorn HTTP Server

nano is a zero-dependency, "convention over configuration" HTTP server entirely based on Java 8.


Nano is available as a self-contained: jar. 

Put a file world.js:



function process(method, requestHeaders, responseHeaders, request, response) {
    response.write("Hello, world!");
    return 200;
}




into the folder hello and start nano with java -jar nano.jar . 4242


Output:



Context registered: /hello/world
nano started in: 441ms at port: 4242



Now curl -i http://localhost:4242/hello/world prints:



HTTP/1.1 200 OK
Date: Tue, 22 Dec 2015 04:28:59 GMT
Content-length: 13

Hello, world!%     




Interested in Micro, Nano, Pico Java EE? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly Microservices with Java 8 and Java EE 7. Is Munich's airport too far? Learn from home: airhacks.io.
