the-frey~/blog

Live code JS lambdas with Scratches

30 May 2018

I’ve been playing around with AWS Lambdas in nodejs recently for a project, and wondered if it was possible to emulate a repl-style editing experience, seeing as most of the time your code is all loaded within one file or namespace.

A friend pointed me toward the Scratches editor, which I’ve found works quite well, although I’ve got some stuff to work out.

You can attach it to your current working directory and require what you need, then get hacking.

So you can do something like:

To make that into an actual Lambda is pretty trivial from there:

Sorry about the weird indentation, I think that gist is a bit messed up.

Anyway, here’s it in action. Nicely light-table like:

Scratches editor

Fork me on GitHub