Making a ToDo list app
Simple sample
contents
The sample app contains a list of tasks in an entity that stores its data in a file. It is possible to add or delete tasks.

Step 1 : Define app settings

1-1 : Create app config file

First we create a folder named todo and in it, we create a file name app.config.json containing :
{
	"name": "ToDo App"
}

1-2 : Define an entity

As a next step, we add the schema for an entity called tasks, in config file, to schemas array
{
	"name": "ToDo App",
	"schemas": [
		{
			"$id": "tasks",
			"properties": {
				"name": {
					"type": "string"
				},
				"status": {
					"type": "string",
					"enum": [
						"WAIT",
						"IN-PROGRESS",
						"DONE",
						"ARCHIVED"
					]
				},
				"progress": {
					"type": "number",
					"minimum": 0,
					"maximum": 100
				}
			}
		}
	]
}

1-3 : Config data storage

Then we define the storage settings. Here we decide to store data of entities in a json file named data.json next to the config file in the todo folder.
{
	"name": "ToDo App",
	"schemas": [],
	"storage": {
		"adapter": "file",
		"path": "./data.json"
	}
}

1-4 : Define an endpoint

To connect to this app we define an endpoint to send NoLang scripts to it and get responses.
{
	"name": "ToDo App",
	"schemas": [],
	"storage": {},
	"endpoints": [
		{
			"type": "cli"
		}
	]
}

Step 2 : Run the app

In the command prompt, Run your app like below:
cd todo
npx nolangjs . app.json
For more guides to run app see here

Step 3 : Contract with todo app

Add new task

Now we can send NoLang Scripts to the app and get its responses.
...              
//send script in one line:               
{"$$schema": "tasks", "$$header": {"action": "C"}, "name": "task1", "progress": 0, "status": "WAIT"} [ENTER]              
//response:              
 TODO

Retrieve tasks

To retrieve list of tasks, we can:
...              
//NoLang script:              
{"$$schema": "tasks", "$$header": {"action": "R"}} [ENTER]              
//response:              
[{ "name": "task1", "progress": 0, "status": "WAIT" }]
contents

Simple Schema

As an example, products is an entity. Three fields are shown in its properties.
{
	"$id": "products",
	"title": "products",
	"properties": {
		"productKey": {
			"title": "Product Key",
			"type": "number"
		},
		"productName": {
			"title": "Name of product",
			"type": "string",
			"minLength": 3
		},
		"address": {
			"title": "Address of manufacture",
			"type": "string"
		}
	}
}

Manipulating data of this schema

For adding new objects to this entity, a script like this is used:
{
	"$$schema": "products",
	"$$header": {
		"action": "C"
	},
	"productKey": "PROD-1",
	"productName": "Product 1",
	"address": "Address 1"
}

Retrieve objects

To retrieve all objects in the entity, use a script with "R" action like below.
(copy and paste then run it).
{
	"$$schema": "products",
	"$$header": {
		"action": "R"
	}
}

Update objects

To update objects, we can use a script with "U" action similar below.
(copy and paste then run it).
{
	"$$schema": "products",
	"$$header": {
		"action": "U",
		"filter": {
			"$$objid": "de710e66-da54-4fb3-ba84-2680ac313049"
		}
	},
	"productName": "new Name"
}