node.js – a nightmare to get started. Did I try the wrong technology for my problem?
Posted by jpluimers on 2017/03/08
Most of my web-stuff is on Apache. Which works fine, has TLS/SSL enabled, etc.
But I wanted to do server-side JavaScript. Which somehow is a forrest without trees, or a nightmare to get started, especially on OpenSuSE.
First of all, virtually all examples explain how to run node as a script. But none explain where to save it, how to run it as a service (and restart when it crashes: it will crash) or how to run multiple sites under it. And the scripts seems to listen to a TCP port by themselves so they operate as a full server by themselves. Nice for a fully fledged portal, but not for some one-offs.
Some links below hopefully will get me re-started later on, but for now, I’ve given up: the out-of-the-box experience is totally non-intuitive.
Maybe what I really want is something else: I want JavaScript stuff that normally renders a page in the browser through the dom to run server side so I can run XMLHttpRequest to various places without bumping into CORS stuff but still render a page DOM.
If you know a better way to do what I want (serving small mostly single-page scripts written in an easy to debug/trace language) let me know.
So basically work around this:
XMLHttpRequest cannot load http://myApiUrl/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Anyway: the links:
- How to deploy your node app on Linux, 2016 edition
Yes, you need to *manually* create your own systemd servies. Aaaargh!
- service – How do I run a Node.js application as its own process? – Stack Overflow
- javascript – Running Node.js in apache? – Stack Overflow
- Installing Node.js via package manager | Node.js
- Usage | Node.js v6.4.0 Documentation
- About | Node.js (totally useless: it gives no clue on how to get started).
- sindresorhus/awesome-npm: Awesome npm resources and tips
- blog.izs.me — Unix Philosophy and Node.js talks about “Small is beautiful”, but node.js feels monolithic to me.
- sindresorhus/awesome-nodejs: Delightful Node.js packages and resources
- Express application generator
- node.js – Which method of caching is the fastest/lightest for Node/Mongo/NginX? – Stack Overflow
- RUN APACHE WITH NODE JS REVERSE PROXY – USING REDBIRD – one zerology
- How to run Apache and Node.js together (the right way)
- linux – Best practices when running Node.js with port 80 (Ubuntu / Linode) – Stack Overflow
- javascript – HTTP GET Request in Node.js Express – Stack Overflow
- javascript – “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” – Stack Overflow
- _
–jeroen






jpluimers said
Some interesting comments on using Go instead of node are at
https://plus.google.com/+JeroenPluimers/posts/aRt6Ni6XW3g
https://web.archive.org/web/20170315183007/https://plus.google.com/+JeroenPluimers/posts/aRt6Ni6XW3g