Getting started


Its pretty simple, just install and play around!


Install less-code

  1. Download and install .NET core Runtime 2.2 if it's not installed on your machine
  2. Download less-code from our download page.
  3. Extract the zip file and it is done

Write a hello world API

Less-code APIs are built on 'blueprints' which is a YAML file that defines all your endpoints, database schemas, and how each endpoint works. Using less-code CLI scaffolding you can easily add various elements to your blueprint.


1. Create a blueprint

You can create a blueprint using the command


$ lesscode generate blueprint

Then less-code will ask you to enter, a name for the app, the author and a version. For this example you can use "helloworld", "awesome developer" and "1.0" as the values.

This will create a new file called blueprint.yml with the following contents;


appName: "helloworld"
author : "awesome developer"
version: "1.0"


2. Create a hello world endpoint

To create a hello world endpoint, use the command


$ lesscode generate view:helloworld

Next the cli will ask for a name to print a greeting message. You can use the default value "awesome less-code developer" and continue.

Less-code will add the following lines to the blueprint with the route GET '/helloworld'


events:
    http:
        helloWorld:
            route: /helloworld
            method: GET
            urn: helloworld
            config:
                name: "awesome less-code developer"

Less-code is based on a concept known as an atoms. Using the blueprint, you can add various behaviors for atoms and configure those behaviors. Each and every atom has a urn to uniquely identify them (in this example the urn is 'helloworld')

Using a atom urn you can create an atom instance, and listen to various events that occur in less-code (in this example the 'helloWorld' atom instance listens to http events)

Each atom instance can also be configured under the 'config' section of the instance.


3. Test the endpoint

To test the endpoints run the command


$ lesscode run

By default less code listens on port 5000. To test the endpoint you can use the command


$ curl "http://localhost:5000/helloworld"

The endpoint will respond with the following output;


{
    "success": true,
    "response": "Hello, awesome less-code developer!. Welcome to the awesome journey of less-code.io!!!",
    "error": null,
    "message": null
}


Explore our features

Less-code.io is designed for enterprise grade API development. In our current version we are providing you the features to write CRUD applications, python scripting, and JWT based autorization.

Checkout our tutorials to explore more features.