Skip to content

Instantly share code, notes, and snippets.

@chickencoder
Last active April 14, 2019 14:19
Show Gist options
  • Save chickencoder/24349b980f663b3442c7fc149dc0ab26 to your computer and use it in GitHub Desktop.
Save chickencoder/24349b980f663b3442c7fc149dc0ab26 to your computer and use it in GitHub Desktop.

cyan

tiny scripting language

  1. A program is just a pure function
import { Env } from 'cyan'
const a = new Env()

a.push('(+ $1 $2)')
a.args([10, 20])
a.run()

Simple microservice

import { Env } from 'cyan'
const env = new Env()

const src = `
  (let path $req.path)
  (puts (cats "Hello"
     (? (get 'name'
      (parse path '/hello/:name')) 'World')))
`

module.exports = (req, res) => {
   return env.pushRun('(put "Hello World")', [req, res])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment