I am working on simple Angular app. Everything is working from angular side.
I created server.js file and included express inside of it. I am not able to run node server.js in the command line.
What is the way to work with both angular and node.
Angular app and express js servr app should both be in different folder and check if express js is installed
If not installed use this command
npm i -g express
Then try the above command
node server.js
Related
I wrapped the contents of my React app in a 'frontend' folder when I started developing a backend. Now the app won't start. Should I deinstall and reinstall node?
Here is my debug log.
I'm new to PM2 and nodejs, I'm trying to learn node by following simple sample that creates a server that displays 'Hello World' from the browser. Please note that I'm running node on QNAP NAS. I have successfully installed nodejs, npm, and pm2. when I run app.js via node app.js, it works and I see the message using the port specified.
but when I run via pm2 start app.js, I got this
Then after a few seconds I got status = errored
when I look at the log I got this.
I tried searching in google but the result were pointing to old version of node which I don't
Node itself has to be built with inspector. You can try to install LTS version of node.
Alternatively, you can try installing node-inspector with npm i node-inspector --save
I have build an app using meteor. I have placed mosca node module inside node_modules folder as server.js. On local machine i used to run meteor then run node server.js on another terminal.
So when i deploy my app to meteor servers, will node run automatically or i have to set something?
Also what will be host address for mosca in that case?
I dont think this method works deploying to Meteor.com (if thats what you mean by meteor servers), you have a couple of options for adding npm packages though:
1) Use the meteorhacks npm package for Meteor
meteor add meteorhacks:npm
create a file called packages.json
{
"mosca": "1.0.2"
}
Then in your server side code you do:
var Mosca = Meteor.npmRequire('mosca');
mosca = new Mosca();
and voila mosca should be usable
2) Try the new npm functionality in Meteor 1.3 + (note: this is currently in beta at the moment) (you will need to specify the --release tag in your deploy)
I am currently setting up my node project and have used Yeoman for scaffolding.
Now my next step is to setup the express server so i can setup my api's etc?
Should I just setup a Server folder where I can setup all expressJS elements and database calls?
How should I be running my server to run server-side code?
Hope someone can assist.
Cheers
First of all, input 'yo' on your terminal.you will see a menu,Select install a generator,if you want to create a express project,you can search express project, you can find generator-expressjs generator-express-angular and so on,you can start on this folders.here is an example.
step1: use Yeoman to create a express project
sudo npm install -g generator-expressjs
step2: install package
npm install
step3: run test server
grunt server
I'm following this tutorial on node.js and express.
The author is on a UNIX machine. To create the app skeleton with express, jade, and stylus, the author says to run the command
./node_modules/express/bin/express -t jade -c stylus
However, I'm on a Windows 7 machine, so this command doesn't work. ./node_modules/express/bin/express jade stylus doesn't do what is desired either.
What is the equivalent of the author's command for Windows PowerShell?
Express can be installed "globally". That means that the OS will create a link to express in the command line that will run the express application creator.
Just add a -g option while installing and then call express directly without the path to node_modules:
C:\project>npm install express -g
C:\project>express --sessions --css stylus --ejs myapp
I recommend you to follow the official guide: http://expressjs.com/guide.html. The tutorial you're following is for Express 2.* and Express 3 changed a bit.