Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sryden/lightning

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sryden/lightning

A web server with variable rendering and import support.

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

SRYDEN Lightning

Lightning is a web server module that supports variable rendering and file imports in HTML templates.

Installation

To install Lightning, run the following command:

npm install @sryden/lightning

Usage

Here is an example that makes use of all of Lightning's features:

  1. Create the Lightning index file (views/index.ltn)
<!-- views/index.ltn -->
<html>
<head>
    <title>:title:</title>
    :{ '/header' }:
</head>
<body>
    <h1>:content:</h1>
    :{ '/footer' }:
</body>
</html>
  1. Use the imports feature to make your code cleaner
<!-- views/header.ltn -->
<header>
    <h2>:headerTitle:</h2>
</header>
<!-- views/footer.ltn -->
<footer>
    <p>:footerContent:</p>
</footer>
  1. Create the main file (app.js)
// app.js
const lightning = require('@sryden/lightning');

let example = "Lightning fast";
let headerTitle = "Header";
let footerContent = "Footer";

// Define routes and middleware
lightning.get('/', './views/index', (req, res) => {
    res.locals = { title: 'Lightning fast', content: example };
});

lightning.all('/styles', './public/styles', 'text/css'); // This allows you to serve static files

lightning.listen(3000);

FAQs

Package last updated on 04 Dec 2023

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