How to write a web server (service) in OCaml? [closed] - ocaml

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
I wish to write a web service server (using http protocol) in OCaml.
For a simple example, I want to write a http server. User can access it and provide parameter like http://myservice.com?i=1&j=2. Then my server get the request and parameters and calculate i+j and return the result.
Of course, my service will be more complicated for the calculation part. Instead of this simple example of calculation, what I really need to do is to
access the database (MongoDB) to get some data
access another 3rd party web service to get more data
calculate all data to get a result and return to the user.
So, I also need to consider parallelism / multi-threading, although I want to start with simple case first.
My questions are:
Which library should I use to first set up such a http server? I have looked into Ocamlnet 3 and think it might be a good candidate, but it lacks good tutorial and I still don't know how to use nethttpd or netplex etc.
How should I design the architecture of my web application? I know OCaml is not good at parallelism, then how can I make each service instance not blocking?

Related

response time API gateway and Lambda [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I need to build api service that would return response with in milliseconds. I am inclined towards using API gateway powered by Lambda.Say I keep my lambda warm by invoking it every 5 minutes or so. Is it slower to use API gate way powered by lambda instead of traditional web service hosted on ec2? Does any one have any experience on this matter?
Your mileage may vary, but after building a bunch of lambda functions to serve some needs I had, I ended up moving most of them back to EC2 in order to get acceptable performance. IN both cases they still use API gateway in front of them.
I still use Lambda for some functions where super-fast response is not needed, but for me it wasn't fast enough.
You should build a few examples and test yourself however, as I said - you results may be different than mine.

Publish data in Power BI [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How can I make our software's data available as an app in Power BI so our customers can choose to integrate their data in Power BI?
I know there is a Rest API and I have seem many samples of how to use this for internal software. However I don't want each customer to have to create an api application. I want our app to appear like Salesforce & Zendesk etc. do so the customer can simply pick us from the list.
Hope this makes sense.
I have helped a client of mine work through the process and it involves working with Microsoft to get the public content pack published. The process is outlined here. I would start by following the steps indicated there like filling out the nomination form and reaching out to support before you begin. There are a number of constraints around authentication and APIs and refresh you need to be aware of before you begin development and it is best to discuss this with support.

What are the best practices in building Microservices APIs in terms of communication technology? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
What are the best practices in chosing specific communication protocol in building Microservices?
For instance, when building MySQL microservice, shall I use the native MySQL connection or prefer a wrapping API in REST or something else?
Secondly, shall I choose and use a single protocol like REST, JSON-RPC etc. for all interaction among microservices?
Thanks!
Use as little layers as possible, so don't do a REST API on top of MySQL if it's not needed. Keep it as simple as possible.
That being said, try to avoid RPC between microservices. Use messaging instead so that the services can be autonomous. We do not want them to be dependent on a service that might not be running or anything. Define bounded contexts and have microservices live within these bounded contexts, making them the owner of a specific business issue.
From that point on you can choose whatever storage, protocols, security, etc. you require for every single microservice. It's probably easier for the messaging system to choose a single option. Although not required, it makes sure you do not need to implement gateways everywhere to convert from one to the other.

Collecting data from website without API [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am looking to build a webapp to improve user experience in booking railway tickets in India. The API is impossible to get due to hefty charge to procure it. I have seen many apps that provide details of the trains etc through their apps.
My Question is how are they scraping data from the website.In general how can I legally get data shown to user (I don't want payment and stuff that are impossible without API) on any website. How do people scrape such data? Any tools/methods?
Bear with me if question is naive. I'm pretty new to this stuff.
They can get the train schedule information using any one of several programming languages though it is most likely done with ordinary PHP and any good webserver host. For example all indian train schedules can be found on the indianrail.gov website.
Sending a specially built URL to ..
http://www.indianrail.gov.in/cgi_bin/inet_trnnum_cgi.cgi?lccp_trnname=1123
using the POST method of sending form data should give you all the details for train number 1123 After that it becomes just a simple task of tidying up the results for storage in a database.
Update: well armoured site its checking both the user agent and referer of inbound requests.
Ammendum: the indianrail.gov site is changing to http://www.trainenquiry.com/ -> will have to take another look

Licensing scheme for client application that accesses web service [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm currently in the decision of under what license I should release a .NET client software that accesses our web service. The best way to describe my situation would be like Dropbox, as they have a client software that simply allows users to access their web service.
I'm not sure whether the best decision is to go open source on this to promote growth, support, etc or to keep the source closed with some to help reduce the number of non-official clients running specifically meant to misuse / abuse the webservice backend.
(If it helps any the client software will be computing and sending data to a backend, so tampering of the submitted data would be best kept at a minimum.)
Pros, cons, and suggestions are welcome
Isn't there a way to work with sessions in a webservice? If you could implement that, you could make the users of the client login first to your webservice (via the client application), and then only make the functionalities available after a successful login. That way, should you decide to release an open source version, you will greatly reduce the risk of rogue clients already.
As for the decision whether to go open source or not, that's entirely up to you, but I don't think the choice should affect security.