Setup Yeoman with express server - node.js

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

Related

reactjs app not run after serve and start

I just installed node.js on my centos 7 server, then install react
it successfully created my new react app, after that, I run:
npm start
and or serve -s build
but none of these run in my browser.
This site can’t be reached
how can I solve this?
If you have sever inside can you try with start debugging of your application
Stop npm, if you're using yarn
Start the project with command above, inside your project home folder
yarn start
Take some time to learn commands below:

Install React JS on Cent OS

I am very very new to React JS and have tried to install it on my VPS server that is running Cent OS.
Node.js seems to be working,
I have build a React project using the following code as a root level user on SSH:
npx create-react-app my-react-project
cd my-react-project
npm start
but when trying to view in browser I get a blank page (instead of react js default template)?
I see many people install this locally but I haven't found any examples on a hosted VPS, is this something I am doing wrong?
Any help would be much appreciated, thanks!
if you have ssh access to your VPS, the rest is pretty the same as your local environment.
You can copy/paste your project to your CentOS host and use the following commands in order to run it:
cd your_project_folder_which_includes_package_json_file
npm install
npm start
Also, if you are using this server as a production host, You should consider getting a production build of your React app on your local env by running npm run build and then publishing the build folder on your server and serving it using a static file server or using a reverse-proxy such as Nginx as a static server.
Actually this page in React documentation does a good job in explaining the details of deploying a React app, I encourage you to take a look at it.

Express is not working on ubuntu

I have installed nodejs,express on ubuntu but when i type "express test" command on terminal on ubuntu, its not creating the folders etc (package.json,app.js, view folder ect).It simply prompts in the next line.
Please help
If you want to generate the scaffolding for a new express app you can use the express-generator.
First you need to install the needed module globaly.
sudo npm install express-generator -g
Then you can use this command to generate your scaffolding.
express <my_app>
More info here http://expressjs.com/starter/generator.html

npm package error - Cannot find module 'users-node'

I installed the users-node package on my Windows7 machine using npm install users-node - great success!
Code:
...
var usermgr = require('users-node')(options, app);
...
But when I run my node server I get:
Error: Cannot find moduel 'users-node'
I implemented the code suggested on this page: https://npmjs.org/package/users-node but I could not download the repository from GitHub - link is broken: https://github.com/dpweb/users-node.
What do I need to do to implement users-node? I need to do users management, so do simple user login on a chat app using Node.js, Socket.io and express.
Are you sure that you didn't install it with -g option?
If so you need to set NODE_PATH environment variable.
The default path for Windows is:
%AppData%\Roaming\npm\node_modules
In case you didn't install it globally, you must place your app.js file beside the node_modules directory which is created after you run npm install users-node

How can I install nodejs modules to appfog

Normally in local, I use cmd, command line to install any nodejs module using "npm install testing or connect or etc.."
But I decided to use appfog as server and I add nodejs to my project on appfg but probably I am gonna need some nodejs modules like testing, connect, request etc..
The problem is I couldnt found tool like cmd on appfog or any way to add nodejs modules.
How can I do this?
Basically, you just need to install the dependencies in your local environment and everything should be just fine. Simply specify all of your dependencies in your package.json file, run a typical npm install, and if the modules are properly installed in your local environment then they will be pushed to AppFog when you run af update.
You just have to develop your application on your local machine with all the required dependencies in the json package and modules in the Node.JS. And if your application is working properly at that time on your local machine then you can push all that application data to the AppFog using command line interface. Simply use the command af update <your app name> Then start the application and you will see that everything is working properly.

Resources