Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reggi/jrender
A super renderer for express, that allows you to edit views in jQuery.
https://github.com/reggi/jrender
Last synced: about 1 month ago
JSON representation
A super renderer for express, that allows you to edit views in jQuery.
- Host: GitHub
- URL: https://github.com/reggi/jrender
- Owner: reggi
- Created: 2013-12-29T03:57:27.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-30T05:00:30.000Z (almost 11 years ago)
- Last Synced: 2024-10-05T10:45:26.199Z (about 2 months ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# jRender
Edit your views with a jQuery server-side postprocessor.
## Installation
```
npm install jrender --save
```## Setup
Here's the middleware in app.js.
```
var jrender = require("jrender");
app.use(jrender());
```## Usage
Here's a route.
```
var route = function(req, res, next){
res.jrender('index', { title: 'Express' }, function($){
$("title").attr("jquery","awesome");
});
};
```If you need the string, and don't wanna send you can pass in the last callback.
```
var route = function(req, res, next){
res.jrender('index', { title: 'Express' }, function($){
$("title").attr("jquery","awesome");
}, function(err, html){
if(err) return next(err);
return res.send(html);
});
};
```