Meteor app linking to external pages/apps - javascript

Hi guys I'm looking to build an application that is a list of stores. One requirement is that for each store there is a special view of the store built in flash or javascript. This special view portion has been already built by someone else. It consists of a single HTML index file and a bunch of javascript/css in it.
So I think it would be very difficult to directly it as a part of the meteor app. What I want to do is to somehow have those special view portions be a separate entity from my meteor listing app. How can this be done? Will it need to be on different servers? Or can I just have two folders (one a meteor app folder, the other just those html+css+javascript/flash files) and have the meteor app have links point to the other folder? Any examples of meteor apps pointing to separate files but still function like a single webpage?

you can connect to another app by using DDP.connect() and it acts like REST API for websockets.

Related

Multiple ExpressJS(Nodejs) Apps on Same Box

I've been searching for a straightforward way of doing this that wouldn't involve editing every single users' host file.
I'm going to have a couple internal apps for employees to use that are going to be hosted on the same Windows Server. I want to use a default port, but want them to be separated out so, for example if you go to
www.host.com/longrunners
you get the longrunners page. If you go to:
www.host.com/databaseMove
you get the database move page.
I'm aware that I could do this by having all of the code within the same server.js file, using app.get('/longrunners',function(res,req){}) etc for each separate app -- but I'm hoping there is a more modular solution. Maye a way to have one master server.js file that references the different apps?
Thanks!

Will I ever need to use ejs or layouts if I use Angular for frontend?

I'm currently using Sails for backend, which comes with an ejs view engine and a templating system which is rather neat. However, setting up Angular on the front end of things will get in the way of these functions.
For instance, I can no longer use templates, because if I have say <html ng-app="myApp"> inside layout.ejs Angular will never initialize.
Same thing should I include any ejs templates.
So what I have done now is created a index.html file inside my assets folder, turned off the Sails routes and layouts, and am purely working with Angular. This will do fine for my current project (except I can't make things as tidy as I'm used to, the boilerplate html need to sit there, etc.) but will it be a problem in other projects, I wonder?
In other words, what am I missing out on by not using ejs? How will I ever be able to get things from my Sails controllers into my views? Or won't I need to?
First this question is WIDE open to interpretation based on all sorts of variables.
If your using your APP simply as JSON delivering API, then in reality you don't need to use the template engine. So the basic premise of your question is valid.
However, their are still plenty of reaons to use the template engine.
For instance, you can still use EJS to setup your default layout and index page for your angular site.
For instance, I can no longer use templates, because if I have say inside layout.ejs Angular will never initialize.
This statement is completely wrong. I use server render templatse for my index page on a SPA in order to use my app version to point to updated assets and template files. That way old template files will not be cached when I update my app. Depending on the app the index page may be the only one to use the template engine as everything else will use static templates. Others I have the server render my templates using the template engine as well (for example: if I want to restrict certain aspects of my templates based on a user role.)
There are other reasons as well. You might try the Google Groups for sails as this is more of an open ended question.
https://groups.google.com/forum/#!forum/sailsjs
If you use Angular for frontend and SailsJs for the backend the best practice is to have two distinct applications which means you don't have use sails to render the views (No EJS mandatory ).
AFAIK SailsJS just need to be used as a REST API while Angular needs to render your views ( you could use http.post get put and delete to comunicate with your api).
Best Regards.
As sails.js is purely backend and Angular.js is purely frontend, they can work together nicely.
All you need to do is place your angular files and logic in
myapp/assets
folder. Assets folder is by default acessible on sails server url.
You can access it as http://localhost:1337/assets/file_name.
As for the ejs, if you are using any javascript framework like angular.js then it is not a requirement as all JSON api will be made in sails framework and angular will get data in JSON format.

Serving two index.html files from angularJS applications developed independently

I have a simple problem. I want to use an angularJS application I developed inside of another one. My question is: what is the best way to include it? Should I combine the app.js files and index.html files to load the appropriate resources and routes? Can I combine it by including one module in the other, like with normal dependency injection? Or is there some other, better way to do this?
Let's assume the application has a root express server and a root/app_client angularJS application. There isn't any code to post outside of my whole app, this is more of an organization question.

Phonegap Build - Get application root directory?

I am looking at porting an existing application to phonegap build, however as my application is a multi-page application with pages split in different locations and a resource loading mechanism which loads files from different places.
So I basically want to be able to get my applications root directory up front and then use that when initilizing the application. Then it does the rest itself once it knows the root directory and has a file managing class which will build the file paths based off this root value.
I did notice this question:
Getting application directory in phone gap
However it does not seem to act the same on each platform, and I need this to be consistent. So is there a simple and consistent way to get a string representation of the applications root directory?
In my case after asking the guys at phonegap, they say that you dont really need to do any of this can just use location.hostname so am looking at using that approach for now, the main reason for asking this is because in trigger.io I would be using tools.getUrl. So I assumed in Phonegap I would need to do something similar.
http://legacy-docs.trigger.io/en/v1.4/modules/tools.html

JavaScript fileWatcher

I am developing a web application (intranet) and it is mandatory to watch a specific folder, for example c:\docs, for inserted files. I would like to do that through JavaScript in order to detect each time the client inserts file into specific directory.
You can build your own application using django. It has very safe methods to handle user models and for handling files.
Question is, do you want a web-based interface for users to manage their documents, or do you want to monitor documents as and when people modify directly in the file system?
For the former, I'd say django is a very good option to build your own app in no time.
EDIT
For the latter, you can use node.js. Here's an interesting project that could get you started - https://github.com/mikeal/watch

Categories

Resources