npm install lavkodeWeb app low code library that makes it possible to write Web Apps using JSON or YAML.
Used internally in the Waveorb Web App Development Framework.
```
npm i lavkode
`js
var lowcode = require('lavkode')
// Page, including layout if specified
var html = await lowcode.page($, page)
// Actions
var result = await lowcode.action($, action)
`
Generally each section in the file refers to a directory in your app with the same name, so filters will look for files in the app/filters directory for example.
If you want to include files in a deep directory structure, use dot notation:
`yml`
filters:
- auth.user
If the reference is a directory, it will load all files in that directory in the order it exists on the disk.
If you want to control the sort order when including a directory, prefix each file name with a number:
``
app/filters/1-login.js
app/filters/2-require-admin.js
Pages have the following possible structure (example):
`yml`
title: Example low code page
desc: This it the meta description
layout: main
filters:
- authenticate
- login-required
setups:
- load-project-data
scripts:
- handleClick
- handleToggleSection
views:
- hero
- intro
- content
- outro
To build the page and return HTML, including layout, do this:
`js`
var html = await lowcode.page(page)
The default name for layouts is main, and will be used if not specified with the page.
Set layout: false to not use a layout.
Layouts are used with pages and have a this structure:
`yml`
head:
- scripts
- views
body:
- scripts
- views
Layouts are not built separately, but included if specified in pages.
To build the layout and return HTML, do this:
`js`
var html = await lowcode.layout(layout)
Actions have the following possible structure (example):
`yml
filters:
- auth
- require-account
flows:
- do
- something
allow:
query:
- id
deny:
values:
- password
validate:
query:
id:
is: id
values:
name:
is: string
To build the layour and return HTML, do this:
`js
var fn = await lowcode.action(action)
`If the actions are named one of the following, they override the
schema` actions:* create
* update
* delete
* upload
* find
* get
* search
Created and maintained by Eldøy Projects
MIT Licensed. Enjoy!