0
votes

I am currently developing an application which has a collection in mongo of tv channels.

The app is growing quite nicely but I was requested to create an external app or page with a different domain just to show the list of updated channels (before channel and current channel and new releases etc)

What I did was create a simple angular app without a server, just pure angular, and I was wondering how am I able to make an http request to get the list/collection of the main application that has the list/collection of the channels.

this is the scheme for channels:

meteor:PRIMARY> db.channels.find().pretty()
{
    "_id" : "2WzykFxP3LpNvh4hq",
    "logo" : "images/alineacion/ultimate/tbn.svg",
    "before" : 104,
    "number" : 105,
    "category" : [
        "Ultimate"
    ],
    "edit" : false,
    "name" : "tbn"
}

QUESTION

How can I make an http request to get the list/collection of channels from a different angular application to an angular-meteor app so I'm able to list the channels?

1

1 Answers

2
votes

There are previous questions about this, and if you are bound to the idea of http call for data access, I would recommend reviewing them. I started here: How to expose a RESTful Web Service using Meteor; this had a link to a github which linked to another github: https://github.com/xcv58/meteor-collectionapi.

Atmosphere also has packages to simplify creation of REST API on your meteor app: https://atmospherejs.com/simple/rest for example. An Atmosphere package is a bit easier to integrate than other source in my opinion.

Finally, I would recommend looking at DDP for your angular app - this allows your app to interact with the Meteor app you have already built by collections and methods which you have exposed.

https://github.com/afuggini/angular-ddp seems to address your specific (angular) case; I have used https://www.npmjs.com/package/ddp-client in a react-native app.