O Language: Web Site Update

The website of that language has been renewed. We converted the site to a documentation site in order to use it more efficiently. So we will create the documentation directly by hovering over the site. You can search by direct documentation.

For example, if you use the term “file” directly on the site, you can make automatic assignments like “Files”. We made searches and corrections in the post. We have adapted our documentation to the most recent version.

 

These types of optimizations will be effective both in terms of google and site. While doing such optimizations, we have updated the site design. You can visit olang.space to see the updates.

 

O Language: First Router

The router socket structure was created with the intention of creating an API over the HTTP/S protocol and exchanging data through the socket. In web based projects it is possible to write web server quickly and easily. In addition, the API can be created in micro-services.

hello.olm (as hello module):

def hello = fn(name){
 return "Hello, "+name+"! Welcome to Olang"
}

router.ola (as router script):

load "hello.olm"

def config = {
 "GET" : {
 "/" : "Welcome to the O-Lang Router!"
 },
 "POST":{
 "/:name" : hello("{{.name}}")
 }
}

show("Listening 0.0.0.0:8080... Ctrl+C to exit.")
router("8080", config);

GET method test:

~> curl -X GET localhost:8080
Welcome to the O-Lang Router!

POST method test (oytun as parameter value for name [ :name => {{.name}} ]):

~> curl -X POST localhost:8080/oytun
Hello, oytun! Welcome to Olang

As you can see in the example, we wrote a web micro service using port 8080 via get and post methods.