Can ember-cli watch and re-run my server code too? - node.js

So I have a simple Ember.js app which communicates with a node.js server using websockets. The stream server doesn't serve the actual ember app - just various bits of data. Can I have ember-cli automatically re-run my server code when a file is changed inside it?
My workflow is currently
ember s
node ./stream_server/index.js -p 4201
Now I can edit frontend stuff and have everything automatically update. Great! However, if I make a change to my server code, I have to manually go in and C-c it, and re-run node ./stream_server/index.js -p 4201. This gets kind of boring when I know that somewhere in Ember, there's a watcher that's already doing this for frontend stuff.
So, any chance of this working? Or do I just use some other watcher tool to do it?
Cheers,
Carl

Related

How to 'build' a node js application?

I have a node.js application that run as a application server.
It is deployed on an Ubuntu 20.04 machine running on AWS, uses nginx as a reverse proxy and PM2 as a service starter.
Everything seems perfectly configured.
What looks strange to me, is that I have a React application, in a similar environment, but, before to move it on the server, I run build it, so creating a sort of packed and not easily human readable application.
My question is: Is there the need to do the same with a node.js application?
And, in case of positive answer, How to 'build' a node.js application?
There is no need to build a normal nodejs application.
What you mean is the use of a bundler e.g. webpack and a javascript compiler e.g. babel. To create a react application, you usually use a tool like create-react-app that sets up all this stuff for you. For react you need the compilation beacause you use the jsx syntax that browsers do not understand. In addition to that a bundler has some more advantages.
Check out this video if you want to know more about it:
https://www.youtube.com/watch?v=5IG4UmULyoA
No you don't have to build anything for node.js you just have to run the server. for client side apps you need to build and serve the Dist through web servers like apache or nginx.

Is it possible to run a Node.js application synchronously with a Node server?

I want to play around with the WooCommerce API and it needs an authorization key that you can generate through your WordPress site. So I'd like to make setup a server with Express, install WordPress on it and then run an app made in a separate app.js file and run it with Node to communicate with that Express server.
I'm new to programming so this might be a "dumb" question, but normally when I start my server with nodemon in de command line, I can't run additional files. I need to close the server first with ctrl + C. Is what I want to do possible, maybe with two terminal screens? Or do I have to download an additional server to run WordPress on, like MAMP?
Thanks!

Is it possible to work on react using JSX, without a node server and using create-react-app

I'm in a big trouble, I'm a really a noob on React and in the company I work on I propose to code a project that was on pure Javascript to update it to ReactJS,
In this project I can't use a node server And I have been coding React without JSX as shown on this page:
https://facebook.github.io/react/docs/react-without-jsx.html
it's working... but as soon as the project gets more complicated, then gets more complicated to code...
I though I have found a solution to work on JSX without a Node server, that is to code with create-react-app:
https://github.com/facebookincubator/create-react-app
I can code on JSX and then run the command "npm run build" and it generates all the React code in the build folder, and then I tried to run build/index.html, but it doesn't load anything, any idea If what I'm trying to do is it possible?
Once you get things working the right way, I highly recommend you use .jsx. You can hook a frontend to any backend you want. Don't you have an existing index.html file that you can import your React entry file into?
create-react-app has its own way of doing things. If you're updating an existing codebase, you should probably be starting from scratch.
You need a server to host your dist/index.html site. This requires you to build a simple server with either node or some other back end programming language. I believe the reason it works whenever you use create-react-app it is because when you npm start create-react-app runs a simple server to host your application. Why can't you use a node server?

NodeJS disable cache

I now learning NodeJS and I want to use Mustache-express as the template engine (I want to use it instead of Pug, because I used it before on FrontEnd and I think it's a really smart and easy template system). I use nodemon to run the NodeJS server and it's work correctly, it restart every time when I change any file, except the views. When I change anything in the view files, I don't seem it in the requests' responses, only when I restart the NodeJS server. What can I do with that?
I already turned out the cache with the following code:
app.disable('etag');
Run nodemon with the command nodemon -e js,html (if the extension of your views is not html, then replace it)

Meteor running on my own infrastructure

After reading the Meteor official documentation regarding this subjet, I would like to know if it's possible to change my code, deploy the new version, but without restarting the node js server? My idea is to have a development server, where I make my updates, and then after testing commit the changes to the real production server, so that I don't break anything.
If this doen't make any sense, what is the current best approach to accomplish the same results?
Thanks a lot for the help.
You should not need to reset the node js server. Any changes to the code will be injected into the client's browser.
From Meteor main page:
Hot Code Pushes.
Update your app while users are connected without disturbing them. When you push a new version, the new code is seamlessly injected into each browser frame in which the app is open.

Resources