Upload files to Angular or Rails - angularjs

I´m trying to integrate a Blueimp Jquery File Upload plugin in my application.
My application has an AngularJS front-end running in a Node.js server and a Rails API backend running in a WEBrick server.
I would like to clarify which is the best practices to store the files? In Angular (this case Node.js) server or the Rails one.
Thanks,
Roberto.

I'm working on an app that has the exact same layout as yours and I came to the same question.
Since I'm trying to separate the back-end and front-end completely and have all the work with the db and files done in the back-end, I found that it's better to save the files in Rails server. That also gives you an option to do background operations with files (using sidekiq, for example), without making users wait for completion in the front-end.
There are lots of tools for file upload from angularJS to the server (Rails), but I personally found angular-file-upload directive easiest to understand and implement. I recommend you check it out.
I hope it helps,
Ulugbek

Related

How To Integrate ASP.NET MVC Backend To Existing React Frontend In Least Invasive Manner?

I recently joined a team with an existing React.js web project. We want to add a ASP.NET MVC backend to this application, but ideally, we want the option to complete the integration slowly without taking down the existing application for a full refactor.
My question is, what is the least invasive way to integrate this new backend, if our priority is to rewrite as little of the frontend as possible right off the bat?
I have seen a lot of information on using Babel to integrate the React.js frontend directly into the ASP.NET MVC file structure, but it might be ideal to keep them as separate projects for now. It does not matter that they compile and build together, we would be fine launching the backend and frontend separately starting out. Really, we would ideally just re-route traffic from our front end to our new backend without changing the front-end project at all.
What we have tried: We did get a ASP.NET MVC backend with a React.js frontend set up using Babel, but wanted to check to see if anybody here has done something similar before copying our entire file structure over.

Hosting an existing Angular website

I am working on a website for a family friend. It's a fairly simple Angular SPA with 3 'pages'. When I'm done, I plan to bundle it into an html, css, and js file. In addition, I own the domain that I'd like to use through google domains.
Currently, I am trying to find a hosting service that will let me upload my 3 files (html, js, & css) and just host it. However, I haven't found any services that let me do that other than AWS. So far, I've tried weebly and squarespace and they make me use their templates and GUI to build the website. If I needed, I could just use their templates. However, I'd prefer to bbuild it from scratch so I can practice my Angular and Node Skills.
Any suggestions for website hosting services that let me upload the html, css, and js files of a website I've already built?
Thank you.
You can do so with any website that supports FTP. If you are looking for something really simple, see:
https://www.bluehost.com/
Amazon, recently launched a service just for this purpose. See:
https://amazonlightsail.com/
Best place to do it : https://pages.github.com/
You can link your domain to gihtub's IP.
If you feel gh-pages are tought. Try others like https://www.hostinger.in/, https://www.hostinger.com/ , https://in.000webhost.com/

Don't know how to convert an Angular Web App made with nodejs to windows exe

I'm a complete noob at programming with nodejs.
I'm developing an webapp with angularjs with this structure:
So, when I run the command "nw ." with the prompt command my application loads correctly.
All I want now is transform all this structure on an single Windows executable for distribute it for my customers.
I'm looking for any solutions like Bat to Exe, APPJS, and a lot of others. But I do not have any success either.
How can I do this?
You are probably going to need to looking at use a tool like ng-template to build everything into a single package or distributing a basic web server along with your site in order to make things work.
This is mainly due to the issue with the browser not allowing XHR requests from disk as AngularJS runs and request the various html files as your views change.
The best thing is to look using a tool like ng-template to compile all of the html partials into a single .js file that can be loaded from disk along with your AngularJS app. This way AngularJS will load all your partials into the $template cache and won't have to make any XHR calls to load them.
The other possibility is to look at something simple like the Cassini Web server or something similar that you can add to your directory and launch with a simple batch file. I say this because you are talking about distributing something to people who may not have Node.js installed, meaning you probably can't rely on them being able perform a bunch of installs just to get to your app.
How to package and distribute your apps solved my problem!

What files do I need to host an angularJS website

I'm trying to host my first website. I've made it using angularjs, bootstrap and yeoman as a generator. However when I tried to upload it, I realized that the full size of everything in my folder (including the generated stuff by yeoman) was nearly 100mb.
What files do I actually need to host? Node is nearly 60mb and grunt isn't much smaller. Any advice would be greatly appreciated.
Assuming you have a web server like nginx or apache already on that server, you just need to upload the dist folder that is created when you run grunt build.
You don't need all that generator and node stuff just to host a simple test project.
What you actually need is a single HTML file, called index.html. Include Angular and bootstrap (you can omit this, too, if you can go without fancy styles) and create a file app.js which will hold your application logic.
http://angularjs.org shows this in a neat way on their landing page, just scroll down to 'The basics'
As static angularjs application will contain mainly HTML, CSS and JS files you can host your project on simple apache webserver. (Apache - http://httpd.apache.org/)
If you are making a dynamic angularjs application you will have webservices returning you JSON data. If you implement the restful webservices in Java (using Jersey) you can deploy you entire angularjs application with java webserivce implementation to tomcat web server. (Tomcat - http://tomcat.apache.org/)
Hope this helps!
Decided to answer this old question because its one of the few that show on google when searched.
You do not need to use Grunt anymore, I do not know if this was needed at the time of this question.
instead just do
ng build my-app
this would have saved me some hours.
link to current doc

Fast way to develop AngularJS in a Java environment

I am currently working on a Java based Maven project that has a REST backend module and using angular JS as a frontend that uses the backend for data. The 2 modules are named "rest" and "web" accordingly and are deployed as 2 separate war files to a glassfish instance during development. The glassfish is on a different machine.
My problem is that this is kind of slow, especially when developing the angular based frontend. Fix a minor spelling mistake, package, redeploy. Not that slow but every character change or fiddling with angular is another 20-30 seconds lost.
One thing I tried is to directly load the files from the source directory into the browser with file:// tag. This is OK as long as it tries to call the REST backend which fails due to CORS (I don't remember the exact error message, it just doesn't work). This happens a lot so it's a no-go.
I'm open to every kind of solution to develop angular in a way that I could see my changes instantly instead of deploying it every time? Much like the guy does in the egghead videos.
I would recommend breaking your Angular JS application into its own separate project, this would be a new HTML5 project on Netbeans. That way you can focus on pure backend and frontend development in their respective projects and you do not have to manually separate the war files. This link will help you to get CORS working if you are defining your RESTFUL services with Jersey Access-Control-Allow-Origin in ajax call to jersey rest web services. Or you can just mock the data out in the front end project.

Resources