Do I need to reinstall nodule_modules for backend if I'm also reinstalling nodule_modules for frontend? - frontend

Basically, do they need to match up? Having some Vue issues (I might actually post a question about that later) but I just want to know if I'm supposed to be editing things in backend as well as frontend. Thanks

Related

Should react and react-dom be devDependecies?

I use webpack to bundle all files for production on the web. Since no code runs on node during production, thus no package being required in production, should all dependencies be development only?
I don't want an answer based on opinions or best practices or intended usage, I simply want what makes sense.
It seems the only answer you will get to this question will be "based on opinions or best practices or intended usage". For those who were not looking for such answers, the answer is:
If there is no backend service in the same project where you are making the frontend app via a bundler, then put everything in devDependecies; otherwise only put the packages you will require in some node.js related code in dependencies.

Single executable for React App and Express API

I have a React App and a Express API. I want to package those two components into one single executable. Is there a way to do this? I don’t want a solution to my problem I want a hint into the right direction if this is possible.
I believe what you mean is not to keep the bundler running as well as the express server, unfortunately that's not possible if you're in developer mode (and) you're expecting realtime updates in your browser, but if you were in production, then it's not even the case that you need to run your bundler, cause your main.bundle.js is already built and ready.
I think this is what you are looking for. https://electronjs.org/
Electron or similar libraries help you to create an executable application which can be installed an run like a desktop application.
The only point you have to keep in mind is for accessing the database you will have to create a REST API and communicate via that.
Link for a simple tutorial.

Using nodejs in the browser?

Following my first question, I realized that the reason I couldn't get anything to work was that I was trying to use the require() method in the browser. In learning that this is not how Node works, I was confused. I understand now that Node is only a run-time environment that allows the use of JavaScript within the console. However, I'm still left with the question of how to achieve the functions of Node within the browser. (i.e. creating a button in the browser that creates a file using Node.) I've installed Browserify but I cannot find a good tutorial on how to use it. I'm very new to Computer Science so please forgive me for the redundant questions. Thanks a lot.
Things do change. Apparently it will be possible to use node.js in the browser soon. You might be interested in this: Run Node.js in the browser
Node as you made the point is server-side runtime environment for js and the browser is client-side. Node.js has many useful built-in functionalities and they are not accessible in browser.
I recommend you to take a look how backend and frontend differs and how do they communicate with themselves. Then I think you will understand how to achieve creating a file by clicking a button in the browser.
Sorry I don't know anything about browserify but it would be better to learn node in cli.

How can I publish a node-express website under an existing server?

I have a web-server with cPanel, but I didn't find the method to make the website properly work. I made an aldomain, updloaded the project, but it doesn't recognise the base css, nodejs server etc... Tha main question is how to run my own server.js file on the server(?!), and how to make it looks like on localhost? Is it possible? If it's not, how can I publish it? I know that I shouldn't send this message here, because it doesn't contain any code, but nobody tells me where can I ask theese kind of questions. Can you tell me this too, please?
Bad news is cPanel doesn't support Node.js. Prof link
Good news is here you can make question without any code.

Building one page apps with angularjs and sails.js backend

I just found out about sails.js and i think it's really awesome. I want to build apps with sails and angular, but i haven't found any guides on doing this. I found this site which is supposed to have a talk on using sails.js instead on express in the mean stack, but there's not video there.
I would be glad for links to videos or blog posts on how to do this.
Thanks all.
This is getting downvoted because its not a direct question about code.
I have a boilerplate sailsjs app that you can use to model your own off of..
https://github.com/mikedevita/sailsjs-v10-angularjs-requirejs-boilerplate
This is based on v0.10 which is in beta right now, but the same concept applies.
I've created a simple yet powerful angular service, published as a bower component: https://github.com/diegopamio/angular-sails-bind
It basically:
Creates the model inside the $scope for you.
Retrieves the model data from the backend using socket.
Watches for changes made by the user in the UI and updates the backend immediately.
Watches for changes made in the backend and updates the UI immediately.
And it does it with just one line of code in your angular app, like this: $sailsBind("", $scope);
I made it as part of a personal project and then I decided to publish it as it could benefit others. It works with sails 0.10. Let me know if it suits your needs or if you'd like to see something else on it.

Resources