Skip to content
Easy data exports to your client-side scripts.
JavaScript Makefile
Latest commit f7b1157 Jun 11, 2016 @vesln committed on GitHub Update Readme.md
Failed to load latest commit information.
lib Add global exports. Feb 19, 2012
test Add global exports. Feb 19, 2012
.gitignore Initial commit. Feb 19, 2012
.travis.yml Add travis file. Feb 19, 2012
History.md Add changelog. Feb 19, 2012
Makefile Initial commit. Feb 19, 2012
Readme.md Update Readme.md Jun 11, 2016
package.json 0.0.1 Feb 19, 2012

Readme.md

Build Status

Important Notice

I'm no longer actively maintaining this project. If you are interested supporting it - ping me on twitter. The only thing that I will ask you is to not change the API drastically. If you are planning on doing that - better start a brand new project.

If you want me to transfer you only the name on npm, I'd be happy to only if the project does not have any downloads on npm lately. In case it's being downloaded, there are people that depend on it and might step up and start maintaining, so I will not transfer it to you, regardless if you want to release a new major version etc.

If you have any other questions, let me know.

Thanks!

Veselin

exports

Description

Easy data exports to your client-side scripts for your express based app.

Synopsis

var express = require('express');
var exports = require('exports');

var app = express.createServer();

app.dynamicHelpers({
  include_exports: exports.helper('App') // App is the namespace.
});

exports.set('title', 'I am awesome.'); // Global export.

app.get('/', [exports.middleware], function(req, res) {
  res.exports.random = Math.random(); // Export per request.
  res.rend('index');
});

layout.jade:

!!!
html
  head
    != include_exports
  body!= body

Result:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>

<script type="text/javascript">
  var App = {"title": "I am awesome.", "random": 0.27449309756048024};
</script>

</head>
<body></body>
</html>

Requirements

Install

$ npm install exports 

Tests

$ npm install
$ make test

License

MIT License

Copyright (C) 2012 Veselin Todorov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.