Parse Cloud - Why need this? - parse-platform

I'm new to parse and i've just setup my server and dashboard on my local machine.
For my use, i just not need the simple API from parse, i need to write a server (with NodeJS + Express) to handle users request.
I've just see how to integrate an Express application with parse, so my application instead of the server directly will use my server that will serve:
The standard Parse API (/classes etc)
All my others route, that could not to depend on Parse API
This is correct ?
Reading online i've see that Parse Cloud need to extend Parse functionality with additional "routing" (if i have understand well).
So, in my application i will have
The standard API (ad described up here)
All other routers (that could not depend on Parse)
Other routers (that come from Cloud) and use Parse API
So, Parse Cloud is just a "simple" way to write additional Routing ? (i've see that exists the job function too, but right now i've not studied it).
My question is just because i'm a little confused about the real needed, just would like to have more info on "when to use it"
Thanks
EDIT
I provide here an example (that in part come from Parse Docs).
I have a Video class with an director name field.
In my Application (iOs, Android etc) i setup a view that need to know all the Video provided from a particular director.
I will have three ways:
Get all Videos (/classes/videos) and then filter it directly in APP
Write an NodeJS + Express router endpoint (http://blabla.com/videos/XXX) where XXX is the director and then get the result with Parse JS API and send back it to the app
Write an Clound function (that if i have understand respond to /functions/) that do the same as the router one.
This is just a little example, but is this the usage of Parse Cloud ? (or at least, one on them :))

Related

One-click OpenAPI/Swagger build architecture for backend server code

I use swagger to generate both client/server api code. On my frontend (react/ts/axios), integrating the generated code is very easy: I make a change to my spec, consume the new version through NPM, and immediately the new API methods are available
On the server side, however, the process is a lot more janky. I am using java, and I have to copy and paste specific directories over (such as the routes, data types etc) and a lot of the generated code doesn't play nice with my existing application (in terms of imports etc). I am having the same experience with a flask instance that I have.
I know that comparing client to server is apple to oranges, but is there a better way to construct a build architecture so that I don't have to go through this error prone/tedious process every time? Any pointers here?

How to connect to MongoDB from a single page ClojureScript / React.js application using Ajax?

Consider a ClojureScript web application using reagent where the reagent components are subscribed to a single db atom containing a vector of maps. The contents of this vector is different for each user and has to be queried from a mongo database ( which is updated with regular intervals ). The database might be hosted by a third party. Considering that CongoMongo, Karras and Monger are Clojure ( not ClojureScript ) libraries what would be the best way to connect to MongoDB from a single page ClojureScript/React.js using Ajax?
This “answer” is more of a comment but here goes.
If you don't absolutely need a Clojure backend, I'd recommend having a ClojureScript-only single-page app without any Clojure wrapper to Mongo (so no need for Sente either). As Timothy Baldridge (of Cognitect, so he knows a thing or two about this 😛) pointed out, your ClojureScript app can just make HTTP REST requests to the database.
cljs-http is a ClojureScript project that uses Clojure's core.async library to make HTTP requests and is perfect for interacting with REST APIs if you know or can learn core.async.
A more conventional (i.e., callbacks) approach, but still very ClojureScript-friendly, is to use Google Closure's goog.net.XhrIo library. I have an example here of connecting to a public REST API using XhrIo and re-frame (built on top of reagent, and highly recommended) that may help show how to get started.
Using either of these ClojureScript/JS libs, you can make requests directly from the ClojureScript browser app to the database, get replies, parse the JSON with (js->clj (js/JSON.parse json-string)) or with transit-cljs, and do something with the result.
Since Mongo has a fairly simple REST interface (https://docs.mongodb.org/ecosystem/tools/http-interfaces/#simple-rest-api), I'd be tempted to just write my own CLJS code that calls the Mongo server. Depends on your security requirements. But writing the CLJS code would be no different than any other remote request. Just a bit of string concatenation and parameter serialization.
You could use sente to get communication going between the Reagent application and your web server. This SO answer references an example client/server application that consists of a web server with browser access, giving you some buttons to press that return information from the server. It is not Reagent - but you can substitute what they use. It is a starting point example that works out of the box.
Then build up the example's web server so that it communicates with the three Clojure libraries rather than just returning static text as it does.

Exporting data from Ada application with websocket

I'm developing a scholar project where I have a core written in Ada language that generates data information.
As requested by the project, I need to send all the new produced information, with a certain period, to a remote webserver via websocket.
In javascript language is really easy to connect to a web socket:
var exampleSocket = new WebSocket("ws://www.example.com/socketserver", "protocolOne");
I would be able to execute a similar command in Ada, is it possible?
May be possible to workaround the problem calling an html page (with GET parameters) containing javascript code so that this page manages the websocket with remote webserver?
For those still looking for this answer; AWS now supports websockets...
https://docs.adacore.com/aws-docs/aws/high_level_services.html#websockets
Both AWS and Black has supports websockets. AWS is the most mature of the two, so I suggest that you use that.

Quick REST server that answers with static responses?

Is there any program that could help me build a REST client without having access to the server? I just want to get custom static HTTP answers when accessing a specific url via POST. It should be as fast and easy as one of the many REST-clients for backend developers.
(No it's not because I develop the client before developing the server, it's because somebody else develops the server and I want to program even when neither this person nor his | her server is available.)
Platform: Windows 7
As long as you can serve static files, you can use any web server as a response generator. Generate your data and save it in the file structure with an extension like .json or .xml. I have found that this works for GET requests but is not very useful for POST/DELETE requests. Sometimes a tool like fiddler http://fiddler2.com/ can let you capture the request while the server is live and then you have it when it goes offline.
If you want a more complex and true rest environment you can use mongoDB's http interface. http://docs.mongodb.org/ecosystem/tools/http-interfaces/ A word of caution. Mongo is a great tool but the learning curve is a little steep of you have not worked with NOSQL before. The plus side is that it doesn't really require an application server since you hook your calls straight into the document structure via it's http console.

In GSOAP, what is the difference between client and server mode?

I use GSOAP to implement a simple program that fullfills ONVIF discovery functionality.
(The NVT, NVR part, not the Device Manager, i.e Client part)
The program needs to
1) Send "ProbeMatch" messages in response to "Probe" messages of the ONVIF DM.
2) Send "Hello" messages occasionally.
I downloaded and launched "gsoap" tool without any problem. I generated h and c files, and created a project in Eclipse.
When I generate C files in "Client" mode, I can build the Eclipse project. There are 3 functions defined in soapClient.cpp but I do not know how to use them in main function ( What are the parameters ns2_HelloType and ns2_ResolveType). And, when do I call these functions?
When I generate C files in "Server" mode, I cannot build the Eclipse project because those functions have signatures in h files but are not defined. I have to define them according to the tutorial of gsoap. (Calculator Example)
http://www.cs.fsu.edu/~engelen/soapdoc2.html
Actually, I couldn't manage to understand the concepts "Server" and "Client". Which part of the ONVIF specification is client, which is the server? Hello, Bye etc. are the functions of the "device" itself so is the device SOAP Server? Can anybody clarify those concepts?
Best Regards,
Firat
What kind of device are you trying to implement? A Network Video Transmitter (NVT)? In this case you need to implement the server.
The client is the part of the VMS that connects to the devices.
When you generate the server part, you need to implement the functions that do something when the correspondent function is invoked from a VMS. This is why you get a build failure.
You asked several questions. This will address only those concerning gsoap, client/server. Regarding your question: I couldn't manage to understand the concepts "Server" and "Client" , Can anybody clarify those concepts?.... So, in the most general terms:
If you are using gsoap, it is because you want to use C bindings to stitch together some component of a web service, either on the server side, or on the client side.
A simple web service Server/Client scenario:
The server, in simplified terms, listens for a request from a client, and based on some provided information from the requester (i.e. the client), queries its data source, usually a database, using the input data, packages up the requested data and returns it to the client. Think of getting the weather from your phone. Your phone, the client, sends some small piece of information such as postal code, to a known WSDL end point. The weather data is returned and displayed on your phone app.
Using gsoap it would look like this:, The request sent from your phone is simply entered as human readable text: 98873-1234, read in from an application using the gsoap C bindings into a C data structure. The C binding (C function) converts the struct data to XML SOAP format using the functionality in gsoap libraries, and sends the XML data via tcp/ip to the WSDL end point of the server. The server side gsoap libraries within an application receive this data, convert it from the XML SOAP format into C type data most likely as a member of a struct. The data is then used to build a query string to the database and make a query. The query is sent to the database. The response, XML SOAP, is again converted to C type data, and using the C bindings (C functions) provided by gsoap, sent back to the requesting client.
Again, in very simple terms it looks like this:
ServerSide database<->SQL<->gsoapApp<->tcp/ip<->gsoapApp<->userInterfaceDisplay ClientSide
There is a client application example here. Although this example is targeted toward client side applications, the concept for server side gsoap code generation is very similar.

Resources