Rohit Dhiman Rohit Dhiman - 1 year ago 251
Javascript Question

How to integrate Angular theme in Node + mysql+ express

I am new to node, angular and express.. Please help me if u can.

I have created REST API using node+express+mysql already,
Now I have to integrate this blur-admin theme into existing project ..
After following instructions i am able to run theme with gulp separately but not know how to connect it with mysql or existing project.

I use

nodemon SERVER
to run existing project


var express = require("express");
var mysql = require("mysql");
var bodyParser = require("body-parser");
var md5 = require('md5');
var rest = require("./REST.js");
var app = express();

var helmet = require('helmet');


function REST(){
var self = this;

REST.prototype.connectMysql = function() {
var self = this;
var pool = mysql.createPool({
connectionLimit : 100,
host : 'localhost',
user : 'root',
password : 'phpmyadmin',
database : 'myApp',
debug : false
if(err) {
} else {

REST.prototype.configureExpress = function(connection) {
var self = this;
app.use(bodyParser.urlencoded({ extended: true }));
var router = express.Router();
app.use('/api', router);
var rest_router = new rest(router,connection,md5);

REST.prototype.startServer = function() {
console.log("All right ! I am alive at Port 3000.");

REST.prototype.stop = function(err) {
console.log("ISSUE WITH MYSQL n" + err);

new REST();

gulp serve
to run blur-admin theme


'use strict';

var gulp = require('gulp');
var wrench = require('wrench');

* This will load all js or coffee files in the gulp directory
* in order to load all gulp tasks
wrench.readdirSyncRecursive('./gulp').filter(function(file) {
return (/\.(js|coffee)$/i).test(file);
}).map(function(file) {
require('./gulp/' + file);

* Default task clean temporaries directories and launch the
* main optimization build task
gulp.task('default', ['clean'], function () {

NOW i don't know how to merge them both

Answer Source

While searching on Internet I found the hint on youtube MEAN stack tutorial video. After that I followed these steps:

Moved angular js "blur-admin" theme to public folder of express executed command

 gulp serve

to run client side and on express folder executed command

nodemon SERVER

To run server side on deferent port. Than made REST API on express as required. Used this API on client side theme controller as

      success(function(data) {
       //code here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download