Is creating an email application possible with angular? - javascript

Is creating an email application possible with angular?
I tried implementing nodejs script but it's not working due to using nodejs script inside angular ts file, giving me the following
Error: Module not found: Error: Can't resolve 'imap'
Any help or guide would be much appreciated.
Thanks

You cannot use modules which depend on Node.js features from a browser. The imap module depends on such a feature: it requires the ability to make raw network requests.
The block here is at a lower-level than Angular.
You could replace direct IMAP (and SMTP) access with a web service since browsers support HTTP and WebSockets.

You can’t make IMAP/SMTP connections directly from the browser, but you could use something like EmailEngine as the backend for any email related actions.

Related

can I use a nodejs library in an html file?

Within an HTML file I would like to use the library nodemailer to send emails. To do this with nodejs I simply put var nodemailer = require('nodemailer') at the top of the script component of my HTML file however require is not a valid function in HTML. When I try to do this I get the error ReferenceError: require is not defined. I would like to know how to use this library from HTML, or if this is not possible, what a good alternative is so that I can send emails from an HTML file.
You can't use Nodemailer from an HTML file.
Browsers can't connect to the SMTP servers required to send mail.
Some libraries designed for use with Node.js can be persuaded to work in a browser, although you’d usually need a tool like Webpack to replace the node module system. This can only work if the library doesn’t depend on any APIs provided by Node.js but not browsers.
Browsers provide no API for sending email (beyond the exceptionally limited mailto: URI scheme which will create a new email for a user to send in their default email client (if they have a default email client)). Nor do they provide any API for direct socket creation which could be used to build such an API.
The library you have found will not run in the browser.
If you want to send an email you need to do it from a server. You can make an HTTP request (either by submitting a form of using XMLHttpRequest or fetch) to get the data from the browser to the server.
If you write your server using Node.js (likely with the Express.js framework) then you can use the library you found.
require and nodemailer are for "nodejs" (server side javascript), so you can't use nodejs functionality in the browser.
check out this link

Send Firebase Push Notification using Node Module

I am trying to use NodeJS module to send Push Notification.
Looking at 'node-sender' module and do not see option to send to Browser (for testing):
https://www.npmjs.com/package/node-sender
What Node Module do you recommend for sending PN?
Thanks.
You could give node-pushnotifications a shot. They have a very detailed documentation and quite fairly used.

Ionic 2 with WooCommerce API

I am having problems in handling GET/POST requests with WooCommerce API in Ionic 2. Can anyone suggest a way how to do it?
I have tried it using code from this link: https://forum.ionicframework.com/t/woocommerce-api-npm-implementation/49753/7
But it shows a runtime error of OAuth Not Defined.
You can use woocommerce-api which has already implemented all what you need to authenticate and use the WooCommerce Rest API but since it is a Node.js module that was meant to be used in a Node.js environment and not inside the browser you need first to transform it to a browser library with browserify .Here is a tutorial to build an Ionic 2 app for WooCommerce using woocommerce-api package
Add this.
declare OAuth: any ;
use https://www.npmjs.com/package/woocommerce-api
It is a Node.js wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this library.
I think by using this package and some setup on the server, you can easily connect your application to the server

direct client-to-client message

I have been working with node.js for a while, now when I'm looking deeper into it, for a chat aplication instead of sending message as client - server - client, there must be some possible ways for direct client to client message sending?
Browsers tend to communicate with servers via HTTP. Some implement other protocols, like websockets & SPDY, but again, these are mostly client-server protocols.
Some plug-ins (like Flash & Java) can open ports and communicate client-client. (AFAIK, haven't actually used them.)
Chrome is the only browser I'm aware of that can (soon) open TCP and UDP sockets from Javascript and do direct client-client communication. At the moment normal web apps can't do this, your app needs to be run as a "Chrome Packaged App", with a special manifest file.
Here are the docs, a blog post describing the feature and a browserify module that can behave like the net node.js module in the browser.
EDIT: This should probably not be tagged as [node.js] since you're trying to run in browsers (not in your node vm), this is a Javascript / Browser question.
This is maybe out of date question, but take a look on PeerJS.
It requires server only as a connection manager (broker). But all communication is done between clients directly.
This does not have anything with server. If you need something like that and if clients are flash you can use RTMFP . For JS i google this library which is js bridge for RTMFP, I dont know how it works. At the end you can write you own library to chat beetween clients but this is much harder(IP addresses are behind NAT, etc...)
I think answer for your question is here
PS Also exist open-source in-browser server which written using JS, but I didn't google it quickly. If you find it, please notify me.
If you just don't want to write your own server you can use:
https://httprelay.io
Use AJAX calls to communicate between peers.

Using Gigya API with node.js

For one of my projects I'd like to try out Gigya as my social network connection provider and am writing my app using Node.js. Has anyone done this?
Gigya provides a JavaScript API that is intended to be used on the client.
http://developers.gigya.com/020_Client_API
It should be possible to adapt that for server side use.
Gigya's client side javascript is intended to be run in the browser as much as possible, since they perform 2 part authentication using cookies set by their domains. You can try to port it to run server side, but none of the public methods will work as advertised.
I've written a wrapper for their REST API using their proprietary authentication that I've been using in a work project for a few weeks: https://github.com/jproulx/Gigya-Node-SDK -- note that not everything has been tested thoroughly as I've only needed to use a subset of the socialize services on the server side. It should serve as a good jumping off point to bootstrap something for your needs.
Gigya does not yet have an official Node SDK. However, I've written an SDK that implements the entire service.
In addition to the standard APIs, it contains special support for streaming data from Accounts & DS.
Git: https://github.com/scotthovestadt/node-gigya
Install with "npm install gigya".

Categories