How to build a server with Iron or Rocket


#1

Hi :slight_smile:
I’m trying to write a server in rust with the support of rocket or iron. The goal is to realize a backend for this task:
SimpleJSON(https://github.com/grafana/simple-json-datasource).

I’m studying all the documentations that I’ve found so far but I can’t find a sort of guideline to follow. Do you have any suggestions?

Thank you a lot!


#2

Have you read the Rocket Getting Started Guide?

I’d highly recommend trying Rocket, of all the Rust web frameworks so far I’ve found it to be the easiest to use and get your head around. It also uses Rust’s powerful type system to help you prove your server is correct, meaning you the compiler can do a lot of the input verification and testing for you.


#3

I’ve read it multiple times but I can’t find a solution :S The documentation is great but still I’m lost


#4

Which bit are you having trouble with? If you explain what you are getting stuck on we may be able to point out where you’re going wrong.

Also, make sure as you go through the tutorial you are doing each of the steps on your laptop. I’ve found that when I just skim through a tutorial thinking “oh I understand this, there’s no point trying it manually” I won’t really learn much and end up confused.


#5

In my mind I have to develop the following steps:

  • receive the request (json format)
  • “break down” data from json format in order to be able to use them
  • identify the query
  • elaborate a result and transform it in json format
  • send back the result as response

I’m stuck at the really first step. I think I have not understand properly how to receive the request and how to manage the json format.