NodeJS from localhost to online site - javascript

I have a site that I created using NodeJS and one page html/jquery everything is working as expected on the localhost provided but I'm getting some issue in putting that site online www.xxxx.com, I already got a .com domain but I don't know which configuration should I do on my site and on code , which mean is there steps to follow on the app.js which contain the localhost:3500 ?
This is the structure of my folder developped under VSCODE
and this is my statement app.js of the localhost
//start the server.
app.listen(3500, function () {
console.log('Example app listening on port 3500!');
});
Hope I mentioned everything
Best Regards

To host a website you don't' just need the domain name (.com) but you need the server and hosting as well.
Here you can find details:
Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu using NGINX (free and open-source)
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
For Windows:
https://www.rapidvaluesolutions.com/tech_blog/nginx-server-deploying-web-applications/

If you're like me who doesn't want to get into the configuration details of the host server, check out heroku. It's a platform-as-a-service that allows you to host a site really easily and it has a pretty generous free-tier. Not much will have to change code-wise maybe just making the port a variable.
One major issue I had with the platform is that you cannot save files on the filesystem using code, you'll have to use an external file storage like AWS.
The other, slightly minor issue is that you need to be using git to push your code to the heroku servers (Not really an issue tbh since you really should look into git if you aren't using it already)

Related

Nuxt-mail works in local but not in online hosting

I configured Nuxt-mail to use an external mail server (from the hosting provider) like this:
I send the email like the following (test both with Axios and not):
Everything works fine when I try it from my computer (localhost) as you can see here:
But it fails when I try from the online website:
The Nuxt app is up as static website, I don't know if it makes a difference.
Do you have any idea how to solve this?
Thanks a lot.
I recommend doing a quick search.
You'll notice what you're trying to achieve (static website) is not feasible. You will indeed need a running node.js server.
PS: websites like Netlify and Vercel do not allow for such thing.
It works locally because you have a webpack dev server running when using your project locally.

Deploy different from view on local server

I was building a site and during building I checked it out through live server and everything was OK. Now after deploying on netlify. The site looks different and scattered, what could be causing this
Because of the different servers that allow certain parameters in the code and in the other not, maybe in live server some of the tags or code that you wrote don't work in netlify.

How to serve a very simple, raw, Ember.js application?

I believe this can be considered a very silly question, but I'm really stuck on it for some time. I have a very simple Ember.js application (that means I am not using Ember-CLI) and since I am using the Facebook SDK in it, I need a valid domain.
Until now, I've ran my app simply by double clicking the index.html file in the browser.
Then, in order to have a domain for my app, I've tried using nginx inside a Docker container (so that I can add the http://<docker-ip> URL in my Facebook settings). The problem was that nginx (with the default configurations from the official Docker image) was somewhat loading a stale version of both JS files and index.html, even though the container had the latest versions of the files. I've even tried destroying the container, then starting it again and the issue persisted.
I've then tried looking at other approaches, but none satisfied my need of something simple:
node.js server, too much for serving a very basic app;
middleman, too much setup because I don't need to compile stuff (no .hbs, no less etc.);
ember-cli server, doesn't work with a normal Ember.js app;
other small JS servers, had to configure them too much for just serving some static files;
GitHub Pages and S3 do work, but...I don't want to deploy each time when developing.
So, please help me in this silly quest, how can I serve a basic Ember.js app (preferably from a Docker container)?

Client-side only AngularJS app

I am a little confused about how to run an AngularJS app.
Let me explain: my team and I are trying to make a project that will have a web service that the client side uses (written in JavaScript+HTML in AngularJS ), my problem is with the client side (some basic understanding).
I have seen the angular example but I don't want to use node and I have a little problem understanding something; how can I start my app(only the client side)?
how can I start it on my local computer so that the routing and everything will work without nodejs(because it doesnt work with file:// )
in general how can I start a site like this on a server with out something like node.
This is no my first website just in this format I never did from scratch and
I think I am missing some basic understanding I tried to research it but got all confused.
how can I start it on my local computer so that the routing and everything will work without nodejs(because it doesnt work with file:// )
Install a webserver
in general how can I start a site like this on a server with out something like node.
Install a webserver that isn't one you wrote using NodeJS. There are plenty out there.
You can do on your local computer using xampp or wamp server.
Same code will work on other server also like godaddys etc.
NOTE: Use relative path instead of absolute path.

Interacting with Firebase (offline and online)

I now this is probably a dumb question, but I'm new to web development and I need to clarify this: to interact with Firebase, my code needs to be in a web server or a CDN, right? I can only test if the connection between Firebase and my files if they are online?
Thanks.
You can build and test Firebase apps without putting the files online anywhere. You can simply create a test.html on your local filesystem and open it in a browser (i.e. as a file://.../test.html url) and Firebase will work 100% fine.
Note that if you want to use Firebase Simple Login (for facebook/twitter/github/email+password auth), the files do have to be served by a web server. You can still do this locally though. You just have to spin up a local web server. This can be as easy as "python -mSimpleHTTPServer" if you're on a unix-like OS (linux, OSX, etc.). Then point your browser at http://localhost:8000/test.html or whatever.
You don't need to put the files online until you actually want to deploy your app and have other people use it.
Your server-side code will need to be on a server to execute, but that server doesn't need to be online. Try a local server like XAMPP or a bitnami stack

Categories

Resources