Socket
Socket
Sign inDemoInstall

larvitadmingui

Package Overview
Dependencies
Maintainers
6
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvitadmingui

Generic admin GUI


Version published
Maintainers
6
Created
Source

larvitadmingui

node.js admin GUI

Installation

npm i larvitadmingui;

Usage

Application startup

In your app, start the admin interface like this:

'use strict';

const	Intercom	= require('larvitamintercom'),
	UserLib	= require('larvituser'),
	winston	= require('winston'),
	log	= winston.createLogger({'transports': [new winston.transports.Console()]}),
	App	= require('larvitadmingui'),
	db	= require('larvitdb');

let	userLib,
	app;

db.setup(...); // See https://github.com/larvit/larvitdb on how to configure the database

userLib = new UserLib({
	'db':	db,
	'log':	log,
	'mode':	'master',
	'intercom':	new Intercom({'conStr': 'loopback interface', 'log': log})
});

app = new App({
	'port':	8001, // Listening port
	'userLib':	userLib,
	'log':	log,
	'db':	db
});

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) {
	const	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.

Keywords

FAQs

Package last updated on 12 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc