New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jqserve

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jqserve

Utility that allows you to run arbitrary server-side jquery code against an html file before serving it.

  • 0.0.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source
       _                               
      (_)___ _________  ______   _____ 
     / / __ `/ ___/ _ \/ ___/ | / / _ \
    / / /_/ (__  )  __/ /   | |/ /  __/
 __/ /\__, /____/\___/_/    |___/\___/ 
/___/   /_/                            

h1. jqserve

Use jqserve to serve files after running them through whatever jQuery code you desire. You'll won't have to think about templating languages, and your designer won't need to fire up a dev server in order to write html and css!

Here's how to make it serve a file from your ./public folder using after modifying it with $('

').text('hey dude').appendTo('body'):

jqserve(request, response, 'index.html', function(err, $){
	$('

').text('hey dude').appendTo('body'); });

The request and response objects used as arguments are the generic ones from "http.createServer":http://nodejs.org/api.html#http-server-158.

Here's how to make it serve a file from your ./public folder using node-static:

jqserve(request, response, 'index.html');

Note: If it cannot serve the desired file, it will attempt to serve ./public/404.html. At the moment, it will crash if this file does not exist when it tries to serve it.

h2. Demo

Note: this is probably not ready for production.

Here's how to run the demo:

git clone git@github.com:DTrejo/jqserve.git
cd jqserve
node server.js

Then visit "localhost:8080":http://localhost:8080 and "localhost:8080/index.html":http://localhost:8080/index.html, and compare the differences.

h2. Performance

It seems that running jquery code against a file before serving it is 2 magnitudes slower than serving it from node-static. Oopsie.

FAQs

Package last updated on 26 Apr 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc