0

I am trying to create a web app in React.js and Scala. So I have a programing code in Scala which just prints a random Name with the current time it prints in my stdout as Json object. It looks something like this.

{ Name : Ash TimeLastActive: 14:24:06:6456}
{ Name : Kum TimeLastActive: 15:44:06:6456}  ...
  1. first thing is i want this println message to go to responses of my web app that I am about to create in react. how can i do that in scala?
  2. my react webapi would be very simple. It would have a start button which should run the scala program and whatever the program outputs on stdout should come to my webpage and diplsay there till i press the stop button. How should i handle this in the front end side .
    1. Can you tell me hwat all technologies should i need to be familiar with to go ahead and make this project happen and at which point do i need which technology.
Ashish Kumar
  • 126
  • 11
  • 4
    Stackoverflow won't like this question, its simply a google question. And also theres a similar question [What Scala web-frameworks are available?](https://stackoverflow.com/questions/1488412/what-scala-web-frameworks-are-available). You would basically need scala http server. I prefer akka-http, theres play framework as well which is pretty common. – prayagupa Jul 17 '17 at 07:09
  • Here's kind of a akka-http hello world - https://github.com/duwamish-os/streaming-canal/blob/master/src/main/scala/HttpRoutes.scala – prayagupa Jul 17 '17 at 07:16
  • can u suggest me web apis i should think of?Should be something like URL, method, parameters and payload – Ashish Kumar Jul 17 '17 at 07:48

1 Answers1

1

I recommend you have a look at scalatra http://scalatra.org/ which will act as your api endpoint so that your web can request for it then you need

you should use the react-create tool to help you create a react project

axios or bluebird to request from your api (Play 2) Library is a bit overkill again you should do some more research

some example endpoint you could try

send a json get request to /random (this is when you run your scala program and send a json)

and then return as a json for react to process (return http status code 200) the stuff you want to display

[
 {
 "Name" : "John Doe",
 "timestamp": "some timestamp"
 },
 ...
]
Hamuel
  • 633
  • 5
  • 16