open-index/open-npm huggingface dataset:
npm package: @sryden/lightning
Description: A web server with variable rendering and import support.
Latest version: 1.0.1

# 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:

```bash
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>
```

2. 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>
```

3. Create the main file (app.js)
```javascript
// 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);
```