Display a doc/docx with AngularJS and Mongoose - angularjs

I store word doc/docx as binary data file in mongoDB (not GridFS) and I would like to display it in my AngularJS client.
I probably should use Google Docs Viewer but what I would like to know is how how should mongoose send the file and how AngularJS should use the object it received to display it.

There aren'y currently any projects out there that allow you to render doc/docx in a browser (that I know of).
Your best bet would be to convert the document to HTML or a PDF before you store it in MongoDB (Apache Tika https://tika.apache.org/ can help with this).
If you are using HTML you can then render that easily enough, if you went for PDF take a look at PDF.js - https://mozilla.github.io/pdf.js/

Related

How to fetch text file from google drive with json contents React Native

I need to access a simple text file from my google drive in React Native.
I saw in this post about how you can use this link structure to get a photo from google drive: https://drive.google.com/uc?export=view&id=YOUR PHOTO ID. Is there a structure like this to get a text document?
People keep telling me to setup a backend using sqlite or something but it seems so overkill for the very little that I need. I don't need to set data I just need to read it from a URL. Also, I tried doing a backend but from my limited knowledge, I can't use a backend server on iOS.
Any Ideas?

How can I store a img into a MongoDB?

I need to make a "gallery" like Google Photos for a class project. My idea consists in a web app that allows a user to upload a file (image) and save it to a db and after that to show it in the web app. I just want to know how should the structure of my collection be if that collection saves a file (<16MB I read for >16MB we have to use gridfs).
For the back-end, I will use Node (with Express, Mongoose ... and so on) and for the front-end I will use react or vue.js. I am not sure yet.
Any suggestion is accepted.
You can do the following two things.
Upload image to s3 and save its link in the mongoDB. More Read(https://medium.com/#fabianopb/upload-files-with-node-and-react-to-aws-s3-in-3-steps-fdaa8581f2bd).
Save image in database in a GridFS collection. More Read
(https://docs.mongodb.com/manual/core/gridfs/#when-to-use-gridfs)

Retrieving images from eBay's gallery using eBay API

So I'm very new to developing with eBay's API (or any API) and can't seem to work out how to reference the images from the gallery in the listing template. I don't want to use the URL specifically but rather use the eBay API to bring the images in from the eBay gallery so you don’t have to upload the images twice.
From What I understand, this can be done through an array using Item.PictureDetails.PictureURL. But I could be wrong.
Anyone done/know how to do this? Any help would be awesome!
I'm using PHP with XML.
So, if i understand your problem, you must call GetItem API (http://developer.ebay.com/devzone/xml/docs/reference/ebay/GetItem.html) to retrieve the data for a single item.
This call return an xml where you can find picture URL.

Upload file using Angular JS

I need to save a PDF file which the user uploads to database as a byte array (in Angular JS). I have tried using the file upload module provided by Angular. It doesnt seem to work for me.I have also tried posting the PDF file through a $http post call of jquery. This method works if I accept the data at the server side as a dynamic object of Newtonsoft. However I need a byte array and I am unable to convert this object to a byte array.
This questions is not really about angular but instead it is, based on your description, about how to upload a file using WebApi.
I would recommend your start trying to upload your file using this exmaple:
http://blogs.msdn.com/b/henrikn/archive/2012/03/01/file-upload-and-asp-net-web-api.aspx
When it is ready then adapting it to your angular app.
I had a similar issue a while back. Have a look at this Stack Overflow link.
Uploading/Downloading Byte Arrays with AngularJS and ASP.NET Web API
If you still have some questions, let me know.
I am sending and receiving a lot of byte array data between my clients and servers using Web API. The approach I use is compatible with iPhones, iPad, Android devices, Macs, and Windows PCs/laptops. I haven't checked it on Windows phones yet, but do not expect any problems.
Regards....

Angular js and snapshot pages

Have read up on angular and generating snapshots for the crawlers
Just want to know if the snapshot needs to have CSS or just plain and img tags for Facebook and Google etc. to work.
Any good examples of how to implement the framework with expression engine or Wordpress.
As I understand it you would actually create two versions of every page. Is that correctly understood ?
Cheers looking forward on trying it out .
As I understand it it's enough to modify the htaccess file to show the snapshots instead of the angular once when the request is coming from Facebook or Google etc.
Thanks

Resources