Installing NodeAdmin for Node.JS on Ubuntu - node.js

I'm a seasoned developer in using the LAMP stack and am trying to switch over to Node.js and play around with it. For database management, I love the flexibility and ease of PHPmyadmin and found the NPM package NodeAdmin to be exactly what I"m looking for in terms of an analogue.
But when trying to install and access nodeadmin, the instructions look like complete Greek to me as someone coming from the Apache environment: https://www.npmjs.com/package/nodeadmin
I ran
npm install nodeadmin
inside the root directory and all looked good. But now I'm unable to access nodeadmin under mydomain.com/nodeadmin as it says I should in the instructions. What directory should I be installing nodeadmin in? What the heck do I do with the code in the "Setup" section of that tutorial?
Thanks in advance for helping break in a newb to his new environment.

Looks like nodeadmin is meant to be run as express middleware. The most basic set up would be to create a new file, let's call it app.js. The content of app.js should be:
var express = require('express');
var app = express();
var nodeadmin = require('nodeadmin');
app.use(nodeadmin(app)); //here is where you add the middleware
app.listen(80);
After that, go to directory where you created app.js and run the following commands
npm install express
npm install nodeadmin
node app.js

It looks like nodeadmin is express middleware, so you don't install it standalone. Instead you include the middleware in your website application and then access it via the same host on the /nodeadmin path.
I guess it uses the mysql config from your app to connect to the same db so you can use it to manage the application data.
var nodeadmin = require('nodeadmin');
app.use(nodeadmin(app));
express is a web framework for building nodejs apps. The nodeadmin module you're using can only be used as part of an express application. You'll need to use something else if you want to run it standalone.
A quick google turns up Express Admin. Looks like it's built using express, but doesn't need to be installed as part of an express app. You could give that a try. There may be better alternatives

I ended up getting more errors after following the above answers and am giving up and installing PHPmyadmin (which I realize I should have done from the beginning). Thanks for the answers.

Related

Install and add custom events of #braze/sdk-web package in sails js/node js

how to install and add custom events of #braze/sdk-web package in sails js/node js. As I followed the documentation of braze but sails js server keeps giving error(restarting the server)
#braze/web-sdk isn't supported in Node.js environments.
If you post the actual error it'll help find the root cause.

Cannot Get/ React JS server tutorial

Im try to do the React JS tutorial and im trying the server in node. I downloaded first, all files in https://github.com/reactjs/react-tutorial/ then I put in folder then I command prompt it. and type npm install then node server.js "Server started: //localhost:3000./
Then when I go to the localhost:3000.is said Cannot Get/ .
What's the problem?
Are you entering localhost:3000 without a period?
If you wish to learn React JS. Please install on the local machine and related module like node JS, etc.
Please have look below link for your review. May be it will help you.
React JS – Install and Setup

ExpressJS - Not able to create Basic App

I installed the express - using npm -g express, And the express is installed globally. which is available on my system in the path of C:\Users\xxxxx\AppData\Roaming\npm\node_modules.
Later I try to create a Basic App, using express in the command of express myApp ( after I mapped a sampleFolder, But the express is not providing any basic app settings.
Instead, it throws the error as :
D:\Tutorials\Angular\Projects - Angular\NG-SERVER>express myApp
'express' is not recognized as an internal or external command,
operable program or batch file.
What is the thing which i do incorrect here? any one help me to create express basic app please?
I am using Windows7 here.
Thanks In advance!
I run this command to fix my issue:
npm install -g express-generator#3
thanks to all,

Installing a Web Server for Node.js

I'm trying to follow a book I purchased called "Pro Angular JS", and I am having trouble getting a web server pointed to the right port. So I go to the command line, run Node, and the first error I get is this, when trying to install connect:
npm should be run outside of the node repl, in your normal shell.
(Press Control-D to exit.)
Ok, fair enough. So I do as the command specifies, and I get it to install just as the user, and it ends up adding a folder called node_modules in my user root folder. Ok, seems like everything still makes sense.
Now, the book tells me to create a server.js file within the Node.js installation folder. There is no Node.js installation folder actually created on my user. I see the node_modules folder for sure. So I'm guessing the root directory of my user is where node.js was installed but maybe it's hidden or something? I believe when I used the Mac installer for Node, it said it was created at usr/local/bin. But I have no idea if that is my user on my computer, or even more root access to my computer.
Lastly, back to this server.js file...so I created it with a text editor, containing this code:
var connect = require('connect');
connect.createServer(
connect.static(".../angularjs")
).listen(5000);
And of course they want me to add this file to the directory where my Node is installed. Currently, it's sitting where my current user (user is kst001) root directory is. This is also where my node_module folder was created when I installed it using the npm install connect line in the shell. They also wanted me to create a folder called angularjs, where I would store my app, and said to place it in the root directory where node.js was installed. Once again, sitting in the root directory with everything else. Yet, when I try and fire up my test document in port 5000 (localhost:5000/test.html), I get a "could not find page" error.
Already tried using this link to solve my problem, which seems dead on for my issue, but it resolved nothing:
Node / connect issue Object function createServer has no method static
I'm using a Mac, by the way. Any ideas, guys? Any help would be much appreciated.
The reason why connect.static() does not work is that the latest major version of connect (3.x) no longer contains all of the middleware that connect was bundled with in 2.x.
The readme for connect has a list of middleware references that show you the name of the module on npm that gives you the old functionality for each middleware (e.g. static is now broken out into its own module serve-static).
I'm following the same book/example and the following works. I claim no credit, it is from another Stack Overflow answer about setting up a simple server plus the contents of a comment on the same answer (question 24346161 link to it from here: nodejs connect cannot find static)
Because I used it in exactly the same learning context (book I also purchased called "Pro Angular JS") and I have been around the houses for 3 hours trying to sort this out (yes a complete novice), I thought I would post it here.
firstly from your node installation directory
npm install serve-static
secondly, your node server.js code for a simple static server to serve your angularjs directory contents in a localhost:5000 browser window, on a Windows 7 machine should be (as at July 2015) ...
var connect = require('connect'),
serveStatic = require('serve-static');
var app = connect();
app.use(serveStatic("./angularjs"));
app.listen(5000);
I just stuck a simple index.html file in the angularjs directory to begin with containing
connection working
to test it and it worked a treat.

What is the different between express and express-generator

As you might know, express released 4.1.0 recently. Now you can not use the command line "express" directly via npm intall -g express which is working just well in version 3.x. When I read the Readme in the package, I saw express-generator. After npm install -g express-generator, I can use the command line. So,what's the difference? Only for global install?
With express 4 the express boilerplate generator command line was extracted to it's own module 'express-generator' because the generator app did not really share code with express web framework and express and generator app can be released independently.
I guess this was a step into the right direction to decouple the web framework from the boilerplate/skeleton generator since this makes express even more lightweight and leverages tools like yeoman that focus on generating things.
The difference is that with Express 4, a lot of middleware and other things that were not necessary for "core" Express were exported into separate modules. The Express project generator happened to be one of those things.

Resources