diff --git a/examples/webserver/basic/README.md b/examples/webserver/basic/README.md new file mode 100644 index 00000000..2b36e251 --- /dev/null +++ b/examples/webserver/basic/README.md @@ -0,0 +1,69 @@ +##WebServer Basic Example + +This example demonstrates a minimal Helidon WebServer application that starts an HTTP server and exposes simple routes. + +##Project Structure + +``` +webserver-basic/ + ├── src + │ └── main + │ └── java + │ └── io/helidon/examples/webserver/basic/ + │ ├── Main.java + │ └── GreetService.java + ├── pom.xml + └── README.md +``` +##Build +Use Maven to compile the project: + +```shell +mvn clean install +``` + +##Run +Start the WebServer using: +```shell +java -jar target/webserver-basic.jar +``` + +The server will start on the default port (8080) unless configured otherwise. + +##Exercise the Application +After the application is running, you can call the available endpoints: + +Root endpoint +```shell +curl -X GET http://localhost:8080 +``` + +Greet endpoint +```shell +curl -X GET http://localhost:8080/greet +``` + +Personalized greeting +```shell +curl -X GET http://localhost:8080/greet/{name} +``` + +This will return: +```json +{ + "message": "Hello {name}!" +} +``` + +Update the greeting +```shell +curl -X PUT -H "Content-Type: application/json" \ + -d '{"greeting": "Hola"}' \ + http://localhost:8080/greet/greeting +``` + +##Notes + +This example follows the standard Helidon project layout. + +For more advanced server features, refer to other examples in the repository. \ No newline at end of file