Giter VIP home page Giter VIP logo

larvitadmingui's Introduction

larvitadmingui

node.js admin GUI

Installation

npm i larvitadmingui;
cd public;
../node_modules/.bin/bower i;
cd ..;

or for latest HEAD:

cd apppath
git clone https://github.com/larvit/larvitadmingui.git node_modules/larvitadmingui
cd node_modules/larvitadmingui
npm i
cd public;
../node_modules/.bin/bower i;
cd ..;

Usage

Application startup

In your app, start the admin interface like this:

'use strict';

var dbConf = {'host': '127.0.0.1', 'user': 'root', 'pass': 'foobar', 'database': 'test'};

// Setup database pool
db.setup(dbConf, function(err) {
	if (err) {
		throw err;
	}

	require('larvitadmingui')({
		'host': '127.0.0.1',
		'port': 8001
	});
});

Start it up and check your browser at http://127.0.0.1:8001 - be sure to setup your MySQL or MariaDB correctly with your database settings in this file.

Set messages or errors in the GUI from a controller

'use strict';

exports.run = function(req, res, cb) {
	var data = {'global': res.globalData};

	data.global.messages = ['Happy message'];
	data.global.errors   = ['Sad message'];

	cb(null, req, res, data);
};

To set messages to the next page load, do this:

if ( ! req.session.data.nextCallData)
	req.session.data.nextCallData = {};

req.session.data.nextCallData = {'global': {'messages': ['Happy message']}};
// or
req.session.data.nextCallData = {'global': {'errors': ['Sad message']}};

These will be loaded on the next page load, and then erased again.

larvitadmingui's People

Contributors

jnetteriksson avatar lillem4n avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.