8

GitHub - cicada-lang/whereabouts-server: A Node.js serverless function that can...

 1 year ago
source link: https://github.com/cicada-lang/whereabouts-server
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Whereabouts Server

A serverless function that can run whereabouts code.

Usage

Run a file:

curl https://wa.cic.run --data-binary @docs/tests/clause-and-effect/worksheet-01-party-pairs.cw

Run multiline text (bash and zsh):

curl https://wa.cic.run --data-binary @- << END

Drink { person: "john", alcohol: "martini" }
Drink { person: "mary", alcohol: "gin" }
Drink { person: "susan", alcohol: "vodka" }
Drink { person: "john", alcohol: "gin" }
Drink { person: "fred", alcohol: "gin" }
Drink { person: "fred", alcohol: "vodka" }

Friends { left, right, alcohol }
------------------------------------ {
  Drink { person: left, alcohol }
  Drink { person: right, alcohol }
}

query left {
  Friends { left, right: "mary", alcohol: "gin" }
}

END

The outputs are JSON lines -- one query one line, You can pipe them to jq to format them:

  • Note that, we use curl -s to disable curl's progress bar.
curl -s https://wa.cic.run --data-binary @- << END | jq

Drink { person: "john", alcohol: "martini" }
Drink { person: "mary", alcohol: "gin" }
Drink { person: "susan", alcohol: "vodka" }
Drink { person: "john", alcohol: "gin" }
Drink { person: "fred", alcohol: "gin" }
Drink { person: "fred", alcohol: "vodka" }

Friends { left, right, alcohol }
------------------------------------ {
  Drink { person: left, alcohol }
  Drink { person: right, alcohol }
}

query left {
  Friends { left, right: "mary", alcohol: "gin" }
}

END

Contributions

To make a contribution, fork this project and create a pull request.

Please read the STYLE-GUIDE.md before you change the code.

Remember to add yourself to AUTHORS. Your line belongs to you, you can write a little introduction to yourself but not too long.

It is assumed that all non draft PRs are ready to be merged. If your PR is not ready to be merged yet, please make it a draft PR:

During the development of your PR, you can make use of the TODO.md file to record ideas temporarily, and this file should be clean again at the end of your development.

License

GPLv3


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK