How to get data from two or more mongo schema in a single api call in feathersJs? - feathersjs

i have configured a basic fathers setup with two services, users and messages(with mongoose) all API endpoints are working. but how do i create an extra endpoint in a service?
i am confused how would i develop a complete webapp only using the default feathers REST endpoints.. for example i have to use an api where i need to get data from two or more mongo schema in a single api call. if i deal it in outside of feathers and use expess routing for this how would i setup the feathers authentications for these new created express routes.. please advise me a best solution my situation.

As explained in the basics guide, Feathers services do not have to be tied to a single collection. In fact, a service does not even have to make database calls at all. You can implement the service interface and make calls to as many collections/models as you want. The chat application guide also shows how to associate data using hooks and further information for that can also be found in this FAQ.

You can try looking into GraphQL to handle such queries. You can use it to create a query that fetches data from multiple mongo schemas. Here's a feathers-graphql tutorial that can guide you: https://medium.com/#mattchewone/graphql-with-feathersjs-4cc67e785bd

Related

How to test WebHooks without an on-premise external system?

I'm trying to teach myself about integrating systems via WebHooks.
In a free/hosted GIS system, I can create a WebHook that would, in theory, POST a JSON object to an external system.
The problem is, I don't have an external system that's available right now for for receiving the POST.
I think I need some sort of publicly available sample server that would:
Receive the POST requests
Do something with the requests (ie. create some sort of record)
...so that I could determine if the WebHook worked correctly or not.
How can I test my WebHooks without having an on-premise external system?
I've poked around websites like Postman Echo and Amazon Lambda. But to my untrained eye, it seems like they're not quite designed for what I need.
You could use any of these options depending on your requirements:
You could use webhooks modules in services like Integromat or Zapier to receive webhook data and then apply transformation.
You could deploy a script on heroku and use the URL generated there to send the webhooks calls.
You could also use services like requestbin, webhook.site etc if you just want to receive webhooks data.
Regards

How do I make an API query and display the Json result?

I'm using an API to receive information from a server. I'm authorising using a token. I can query using curl or various api testers online. But now I'm trying to learn how to implement (and request) the results in practice.
I'd like to query, parse and display the json result on a web page (preferably a Wordpress site).
So I need to make a get request, authorise myself using my token, and receive the result and then display it in a nice way.
How do I do that?
This is a vague question, not really sure if you are making requests from just one side but you have 2 options, albeit one being better than the other.
You can create add multiple functions inside your themes function.php file to extend its capabilities but again these are limited to only the theme you are using.
I would recommend that you build a plugin, this will give you the flexibility to use both JS and PHP to do whatever you need to do. With this method you can create a shortcode to display the results from your API query.
You will need to learn to use the Wordpress function wp_remote_get() to perform external API calls.
Here is a tutorial with more information:
Create Plugin and Create External API Calls
Parse JSON from Remote API
Hope this helps

How to show Laravel database data in Ionic

I am integrating an Ionic Framework with Laravel. In MYSQL table there is a option table(master-table) which is having certain options says Table, chairs, suite case etc etc.
I am not getting how can I fetch the data of table in ionic view to display all the options in dropdown.
When I was developing web Application as its in laravel, so in blade view I can directly able to fetch it.But I am not getting an Idea how to do it in ionic view, as I am consuming API services.
Please guide me for this.
For safety reasons it is usually best practice to create a rest api and call the endpoints via the http module to access your database. See the link: https://ionicframework.com/docs/native/http/
If you choose to access the database that means you would have to store credentials in the ionic app which is quite dangerous.

Implementing IoT PowerBI table schema

I'm currently implementing an IoT solution that has a bunch of sensors sending information in JSON format through a gateway.
I was reading about doing this on azure but couldn't quite figure out how the JSON scheme and the Event Hubs work to display the info on PowerBI?
Can I create a schema and upload it to PowerBI then connect it to my device?
there's multiple sides to this. To start with, the IoT ingestion in Azure is done tru Event Hubs as you've mentioned. If your gateway is able to do a RESTful call to the Event Hubs entry point, Event Hubs will get this data and store it temporarily for the retention period specified. Then stream analytics, will consume the data from Event Hubs and will enable you to do further processing and divert the data to different outputs. In your case, you can set one of the outputs to be a PowerBI dashboard which you can authorize with an organizational account (more on that later) and the output will automatically tied to PowerBI. The data schema part is interesting, the JSON itself defines the data table schema to be used on PowerBI side and will propagate from EventHubs to Stream Analytics to PowerBI with the first JSON package sent. Once the schema is there it is fixed and the rest of the data being streamed in should be in the same format.
If you don't have an organizational account at hand to use with PowerBI, you can register your domain under Azure Active Directory and use that account since it is considered within your org.
There may be a way of altering the schema afterwards using PowerBI rest api. Kindly find the links below..Haven't tried it myself tho.
https://msdn.microsoft.com/en-us/library/mt203557.aspx
Stream analytics with powerbi
Hope this helps, let me know if you need further info.
One way to achieve this is to send your data to Azure Events Hub, read it and send it to PowerBI with Stream Analytics. Listing all the steps here would be too long. I suggest that you take a look at a series of blog posts I wrote describing how I built a demo similar to what you try to achieve. That should give you enough info to get you started.
http://guyb.ca/IoTAzureDemo

DynamoDB: How to call dynamodb api from ZF2 rest application

I have an existing app with mysql as backend, We are shifting from mysql to DynamoDB, I want to call Dynamodb api from my ZF2 rest.
I am working with this module: https://github.com/aws/aws-sdk-php-zf2 (which help to interact with Dynamodb)
Any light on the path would be great
Thanks
I am able to accomplished this task by extending AbstractRestfulController and we can use Get, Create, Delete methods to call the api
The AWS Module will help in communicating with DynamoDB.