npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jackson

v0.1.4

Published

Jackson, the web application framework

Downloads

164

Readme

Jackson

Jackson is a web application framework for Node with a focus on simplicity, composability and ease of use, including the batteries you need to build everyday web applications.

Jackson is a new project under early development.

Quick-and-dirty example

Jackson is currently undocumented and you shouldn't use it yet for non-trivial/production sites.

Here is an example which outlines how routes, controllers and applications work in Jackson:

class Blog extends Jackson.Application
  @route '/', 'Posts#index'

  @route '/posts', 'Posts#index'
  @route '/posts/:id', 'Posts#show'

  # or use shorthand to create a whole resource à la Rails
  # @resource('/posts', 'Posts')

  templateRoot: __dirname + '/templates'

class Blog.Posts extends Jackson.Controller
  templateDir: 'posts'

  index: -> @render('index.html', posts: Post.all())
  show: (id) -> @render('show.html', post: Post.find(id))

class Blog.Api extends Jackson.Application
  @resource '/posts', 'Posts'

  class @Posts extends Jackson.Controller
    index: ->
      @respond(Post.all())

    show: (id) ->
      if post = Post.find(id)
        @respond(post)
      else
        @respond(404)

class Admin extends Jackson.Application
  @route '/', 'Dashboard#overview'
  templateRoot: __dirname + '/admin_templates'

  class @Dashboard extends Jackson.Controller
    @beforeAll 'authenticate'

    # contrived example, demonstrates before filters
    authenticate: ->
      if @req.ip isnt '127.0.0.1'
        @respond(403, 'Local only.')
        true

    overview: -> @render 'overview.html'

blog = new Blog
blog.mount '/api', new Blog.Api
blog.mount '/admin', new Admin

blog.listen(1234)

Command-line interface

Jackson has a neat command line interface, with the jack command.

Create a new application:

$ jack new MyApp

$ cd my_app/

Pass --js to jack new if you would prefer not to use CoffeeScript.

Start the application:

$ jack server

This is the default command, so you can just use: $ jack.

The default Jackson port is 1234. Pass another like jack --port 5858

You can also listen on a Unix socket with jack --socket /tmp/myapp.socket

Application REPL!

You can drop into a REPL with your application loaded:

$ jack repl ('r' for short)

Your app is available as app. You'll also have Jackson and your application class defined.

If you want to expose more to the REPL, add stuff too app.repl like:

app.repl.greet = -> 'hello'

When in the REPL, you'll be able to use greet().