Skip to content
File

Blob: samples/repl-server-python/client.js

javascript20 lines
1const repl = require("repl");
2 
3const myeval = async (cmd, ctx, fname, callback) => {
4 const res = await fetch('http://localhost:8080', {
5 method: 'POST',
6 headers: {
7 'Accept': 'application/json',
8 'Content-Type': 'application/json'
9 },
10 body: JSON.stringify({cmd})
11 });
12 
13 callback(null, await res.text());
14}
15 
16repl.start({
17 eval: myeval,
18 writer: a => a
19});