2.0.0 • Published 4 months ago

express-shortcuts v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

express-shortcuts

A very simple Node.JS library intended to speed up the coding time and reduce the file length (and therefore ending up with more readable code) in simple express projects. I don't see any reason not to use this on larger projects too if you like the simplicity, but it is designed with simple projects in mind.

Installation

The package is aviable in the npm registry. You can install it on the command line using the following command:

npm i express-shortcuts

Examples

There are two ways to use the library.

Import what you need

Import only the functions needed on each file.

const { send } = require('express-shortcuts');

app.get('/', send('Hello!'));

Save the functions on the global variable

Import once at the start and use the functions everywhere.

// index.js
require('express-shortcuts')._inject();

// hi.js
app.get('/hi', send('hi'));

// bye.js
app.get('/bye', render('bye_page'));
2.0.0

4 months ago

1.1.0

9 months ago

1.0.0

9 months ago