Hosting with Nodejs? - node.js

I want to upload my first site in node. I have a hosting and domain bought. by default it comes with apache as web server.
Is there something I can configure using ftp to make it work with node, or should I communicate with the hosting provider to make it work with node?

Related

AWS - having subdomains point to different applications - backend / react app / static landing page

I'm currently developing a full-stack web application + mobile app. I've pushed my API backend (node.js express) to an AWS EC2 instance.
Now I'm looking to create the frontend with React. As well as a landing page which I think will be just plain HTML (or even WordPress if possible?) to get it running asap.
Questions are:
should I upload all 3 to the same instance? if so how?
can I point my domain in a way where mydomain.com - serves the landing page, api.mydomain.com serves the backend for requests, and app.mydomain.com serves the react app.
This solution is entirely upto you here, if this is a personal project or one with a tight budget then yes you can put all applications onto the same server.
If you have a HTML only application then you could deploy that specific application to Amazon S3 with a CloudFront distribution in front to provide CDN functionality.
If you do run the applications on your server then you will need to ensure that the web server can resolve each set application individually through hostname for example Nginx uses server_name to define the web domain name for that vhost.
I would suggest if you're running all on the same box run each node application on a seperate port, then use Nginx as a proxy based on the domain name. More information on how to set this up is available here.
Finally add DNS records to target the host IP (or CNAME if you use CloudFront).

If I host my nodejs application on Heroku or other hosting platform can I ignore serving my app using HTTPS?

I have started creating my own nodejs app (for the first time) that I hope to deploy at some point, perhaps to Heroku or another platform.
I need for my app to encrypt traffic namely for user passwords and sessions (note there is no other obviously sensitive data).
I started looking into serving my app using HTTPS (SSL) however I am now wondering if I need this. If my app is to be hosted and deployed using Heroku/other platform won't all requests be trafficked through their servers presumably using HTTPS by default? I am guessing that the request will then be routed using HTTP to my application, although I am struggling to understand how this works. Ultimately I would like to know if I can ignore worrying about paying for SSL certification and such like when it will not matter in this hosting environment?
Help much appreciated. Matt.
If you are using heroku then you must be using paid dyno( hobby or professional) and heroku provides free SSL to all paid dynos. Furthermore if you think that at some point you can switch hosting then there is always freessl available via Let's encrypt.
Heroku serves all requests with and without SSL in default herokuapp url.
Use cloudflare free plan. Open a free account in cloudflare, Copy the DNS. Then set the DNS in your domain service provider (godaddy or sth), then change the Cname config for the website inside cloudflare. Now you have a free certificate.

How can I link my Domain that ive purchased on NameCheap to my React Project?

Ive been trying to deploy my react app with my Domain that i bought on NameCheap.
Couldnt find any answer (maybe, I am searching with a wrong keyward).
Do I use Node.JS to connect my Domain or is it possible to use the domain just with React?
I think you are confusing Domain names and Hosting.
Your app (React or React + Node or any other framework) needs to be hosted on a server (which can be a 'cloud' server or VPS - virtual private server). Well-known hosting services include Amazon (AWS), Heroku, Now (Zeit), DigitalOcean, etc.
Regardless of the hosting service, you will usually end up with a numeric IP address that points to your deployed application.
Domain name hosting is the other 'half'. When you buy a domain, you still have to set it up, i.e. you have to define the DNS (domain name service) entries for that domain, be it for serving a web site or app, a mail exchange, etc.
Your Domain name provider usually has an interface that allows you to edit DNS entries for any domain you purchased with them. This is where you will make the connection between your Domain name and your hosted app.
A typical top-level entry, known as an 'A' entry will be:
mydomain.com A 91.223.9.9
meaning route requests to mydomain.com to IP address 91.223.9.9 (the IP address you will have retrieved from your application hosting service).
If your project is not requiring node.js running in background, it is absolutely possible to host it with any hosting provider, including but not limited to Namecheap. If you purchased a hosting from them (or any other hosting provider) and successfully build your application (i.e. it works for you locally), just upload the contents of /build folder to your hosting server.
If your hosting provider is using cPanel (Namecheap does), this usually means that you should upload it to ~/public_html/YOUR_DOMAIN_NAME.
If your application does require node.js, there are few hosting companies that offer this as well. I am not sure I'll be able to make any advertisements here, so please ask around. Webhostingtalk is a good place to start.

IIS 8.0 and SSL and Subdomains Webapi/Angular

I am Developing a web site that has Angular.js based client and Web API 2 server.
Both will be deployed under my website subdoman: "Admin.myDomain.com".
I would like to have ssl support. (on client and also requests for server)
Thinking that the client will be under Admin.myDomain.com and the Webapi : Admin.myDomain.com/admin/
In term SSL connection - What should be the best way to deploy this?
What I thought:
1. Connect the IP to the machine - Conenct the SSL work on entire IIS level.
2. Have the angular client side deployed on default web site on IIS.
3. have the web api deployed as subfolder (another applicaation).
will this work?
Is there a better way?
You can create your certificate specifically for admin.website.com or with a wildcard for *.website.com. It depends based in your future needs and available budget.
I would suggest to avoid Default Web Site and create a new WebSite that accepts only 443 (and link the certificate here) then you put your API running there with something like.
https://admin.website.com/v1/api
and your angular application at:
https://admin.website.com/app

Best place to host my Sproutcore app backed up by Cloudant CouchDB?

I have a Sproutcore application which uses CouchDB hosted by Cloudant. In devenv I'm using Sproutcore proxy to forward requests to Cloudant (due to single origin policy I obviously can't call a arbitrary hosts from my JavaScript).
What would be your suggestion on hosting the app. CouchApps loading script is failing with obscure error (please note Sproutcore app is around 40 MB of JavaScript and resources).
The thing about hosting an app that talks directly to couchdb is that you are restricted by the same origin policy, so the server that serves up your SproutCore app, has to be on the same domain as you access your couchDB database. If your host provides a static file server, you could use that, but your best bet is probably just to save it as a couch app.
The Key with deploying SC as a couch app, is that you have to set up the URL's that sc-build generates to point to the correct location. This can be done with the buildfile setting something like this:
:url_prefix => '<database>/_design/<designDocument>/'
This way the links point to the right location.
You can also setup CouchDB url rewrites to get simpler urls if you wish. Have a look here for more discussion on this:
https://groups.google.com/d/topic/sproutcore/-D-5T5yPg3A/discussion
PS: 40mb seems overly large! do you have many images? I'd be concerned if you had that much JS/CSS.
Cloudant hosts its clusters (mainly) on EC2 in the us-east-1b or us-west-1b availability zones. If you cannot deploy as a CouchApp you should try to colocate your application layer next to your DB cluster. That will minimize the latency between the web server and the databases.
You can do this yourself by getting an EC2 instance and running a web server on it, or you can use a third party host that hosts on AWS (e.g. Heroku).
In both cases, you will need to run a small proxy from your web server to the database. That's why simply hosting on S3 is not an option at the moment.
Once you deploy your app to a web server, don't forget to check that your web server and your database are in the same AWS availability zone. If they're not, just ask Cloudant to move your account.

Resources