New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ntlab/express-middleware

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ntlab/express-middleware

Nodejs Express Middleware

latest
Source
npmnpm
Version
2.6.0
Version published
Maintainers
1
Created
Source

Nodejs Express Middleware

Nodejs Express Middleware is a set of middlewares build for Expressjs aimed at:

  • Support layout rendering.
  • Provide block and slot mechanism to include views in Expressjs (block and slot helper).
  • Provide NODE-NTJS script integration (script, scripts, javascripts, stylesheets, and jsloader helper).
  • Provide menu builder (menu helper).
  • Provide pager builder (pager helper).
  • Provide a simple security to Expressjs routes (user helper).

Expressjs Integration

Here is a typical usage in Expressjs app.

// app.js

const { ScriptManager, ScriptAsset } = require('@ntlab/ntjs');
const { Helper, Security } = require('@ntlab/express-middleware');

// register script repository
require('@ntlab/ntjs-repo')();

// security
app.use(Security.core({}));

// app helpers
app.use(Helper.core());
app.use(Helper.menu());
app.use(Helper.pager());

ScriptManager.addDefault('SemanticUI');
ScriptManager.addAsset(ScriptAsset.STYLESHEET, 'app.css');

// relative from layout
app.slots = {
  mainmenu: {
    view: '../slot/mainmenu'
  }
};
<%# mainmenu.ejs %>

<% menus = {
    branding: {
        type: 'brand',
        title: apptitle,
        logo: '/images/logo.png',
        url: '/'
    },
    tasks: {
        title: 'Tasks',
        class: 'right floated',
        items: {
            about: {
                title: 'About'
            }
        }
    }
} %>
<% if(user.authenticated) {
    Object.assign(menus.tasks.items, {
        divider1: {
            type: 'divider'
        },
        profile: {
            title: 'Profile'
        }
    });
} %>
<%- menu(menus, {mainmenu: true, indentation: 2}) %>
<% script.create('JQuery')
  .useDependencies(['SemanticUI/Dialog/Message'])
  .addMiddle(`
$.tasks = {
    about() {
        $.ntdlg.message('task-about', 'About', 'About App Message', $.ntdlg.ICON_INFO);
    },
    profile() {
        $.ntdlg.message('task-profile', 'Howdy', 'Welcome User', $.ntdlg.ICON_INFO);
    },
    init() {
        const self = this;
        $('.menu-about').on('click', function(e) {
            e.preventDefault();
            self.about();
        });
        $('.menu-profile').on('click', function(e) {
            e.preventDefault();
            self.profile();
        });
    }
}
`).addLast(`
$.tasks.init();
`); %>

Example Usage

Nodejs Express Middleware is heavily used by NODE-SMS-TERMINAL and NODE-SMS-GATEWAY.

Keywords

expressjs

FAQs

Package last updated on 26 Feb 2026

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