Giter VIP home page Giter VIP logo

Comments (4)

dmolina avatar dmolina commented on August 20, 2024 2

Thank you for your interest. I am going to add the REST API, these days I am a bit busy with the starting of second semester, but I hope to do it for next week.

from daemonmode.jl.

dmolina avatar dmolina commented on August 20, 2024 1

Thank you for the suggestion. I copy the idea. I had chosen the socket option because it is in the standard library, but actually rest api could be simpler. After making possible that the server and the client are in different computers, I will add it.

from daemonmode.jl.

zahachtah avatar zahachtah commented on August 20, 2024

This would be extremely useful. Is it implemented already? didn't see it described in the readme.

from daemonmode.jl.

NightMachinery avatar NightMachinery commented on August 20, 2024

I created a basic Genie app to try and do this: https://github.com/NightMachinary/RestingDemon

The file https://github.com/NightMachinary/RestingDemon/blob/master/routes.jl is where the logic should be defined:

using Genie, Genie.Router, Genie.Requests, Genie.Renderer.Json
using DaemonMode

route("/jsonpayload", method = POST) do
  @show jsonpayload()
  out = runexpr(jsonpayload()["code"])
  json(out)
end

The problem is that I need runexpr to return stdout, stderr, and the resulting Julia object to me, so that I can put them in the JSON response; But runexpr just dumps stdout (etc) to the Genie app's stdout, and doesn't return anything.

Using

route("/jsonpayload", method = POST) do
  @show jsonpayload()
  code = jsonpayload()["code"]
  out = eval(Meta.parse(code))
  json(out)
end

I can at least do the easiest stuff:

echo '{"code": "1+(8*4)"}' | curl --fail --silent --location --header "Content-Type: application/json" --request POST --data '@-' localhost:8000/jsonpayload

33

from daemonmode.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.