Skip to content

rill-js/set

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rill
@rill/set
API stability Standard NPM version Downloads Gitter Chat

Simple utility to set a local variable using a middleware.

Installation

npm install @rill/set

Example

const app = require('rill')()

// Set a local variable for each request.
// Uses the same setter as the query string parser
app.use(set("a", 1))
app.use(set("b[]", 1))
app.use(set("c[d]", 1))


app.use(({ locals })=> {
	locals //-> {
		a: 1,
		b: [1],
		c: { d: 1 }
	}
})

Contributions

  • Use npm test to run tests.

Please feel free to create a PR!

About

✍️ Set a local variable in all requests for Rill.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published