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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vatican

v1.5.0

Published

Micro-framework designed to create REST APIs with minor effort and using annotations

Readme

Vatican

NPM

Vatican attemps to be a micro-framework for creating APIs as quickly as possible. One of the key features of Vatican is the use of annotations on methods to define the endpoints of the API.

For a full code example of an app using Vatican, check out this repo: https://github.com/deleteman/vatican-example

Versioning your API

By default, there is no versioning available. On the constructor, you can set the versioning strategy.

new Vatican({
	versioning: true
	})

Will enable default versioning behavior, which means it'll use the major version of each endpoint as part of the URL prefixed by a "v", i.e: /v1/your/endpoint

new Vatican({
	versioning: {
		strategy: "url",
		matching: (urlV, endpointV) {
			let v = urlV.substring(1);
			return +v == +endpointV.split(".")[0];
		}
	}
	})

Using the strategy property, you can set a custom version matcher for your URLs. In the above example, it'll match URLs as /1/your/api

You can also tell Vatican to use header versioning instead of modifying your URLs

new Vatican({
	versioning: {
		strategy: "header"
	}
	})

The header used will be the "Accept" header, with the following format:

accept/vnd.vatican-version.[version number]+json

Specifying your endpoint's version compatibility

@endpoint (url: /books method:post versions:[1.2, 1.3, 1.4])

Matching function

This function is optional, if you don't provide a matching function, urls will contain the full version number you define for your endpoint (i.e /1.2.3/your/endpoint) and that number will be use to match it during the request.

Installing Vatican

$ npm install vatican

Running the tests

$ npm test

More info

  • Check out VaticanJS official documentation: https://www.fernandodoglio.com/vaticanjs-docs

Changelog

v 1.5.0

  • Added support for OPTIONS methods
  • Added endpoint versioning support
  • Added on-ready event, to avoid code referencing handler that haven't been parsed yet.
  • Added on-ready event for the database, this way, working with DB events and Vatican's events works the same way
  • Removed the need to start working with dbStart
  • Added SERVER-READY event, optional, if you want to be notified when the HTTP server is up and running

v 1.4.0

  • Added support for ES6 classes as resource handlers
  • Changed generator code to create ES6 compatible classes for resource handlers
  • Cleaned-up some code

v 1.3.2

  • Added close method on main server.
  • Fixed bug #30

v 1.3.1

  • Added new name attribute to @endpoint annotation
  • Added ability to set pre-processors on specific endpoints by name
  • Added model generator working with MongoDB
  • Auto generate handlers method's code based on their name
  • New generate syntax, allowing to specify attributes, types and http methods
  • Added index.js and package.json generator
  • Added tests to main components (Still needs more work)
  • Added removal of comments on handlers files, so now if you comment out an endpoint, it won't be parsed.
  • Improved handler parser regex
  • Improved general processing of handler file code.
  • Changed request parser to auto-parse content of PUT and POST requests into JSON (when possible)

v 1.2.4

  • Fixed bug causing incorrect parsing of post/put body content

v 1.2.3

  • Fixed bug preventing the handlers from loading installed modules using 'require'

v 1.2.2

  • Fixed bug causing problems with the pre-processing chain and the handler methods.

v 1.2.1

  • Fixed bug causing vatican to match incorrecly urls with similar templates
  • Changed preprocessing chain, so that now handler methods recieve the next function and can trigger the generic error handler functions

v 1.2.0

  • Fixed support for PUT requests
  • Added configuration overwrite on Vatican constructor and cli commands
  • Added callback function to start method of Vatican called after successful start of http server.
  • Updated cli help
  • Handlers are now stored in-memory after the first time they're loaded, so they're not loaded on every request.

v 1.1.0

  • Added pre-processor to request
  • Added post-processor to response
  • Fixed bug causing incorrect request parsing on non-post requests.

v 1.0.1

  • Changed default handler folder for create command
  • Minor readme fixes

v 1.0.0

  • Added create new project command
  • Minor fixes on readme

v 0.1.1

  • Added auto-stringify of objects passed to the send method on the response object.
  • Edited readme

v 0.0.1

  • First version

Contributing

If you feel like helping out by bug-fixing, or contributing with a new feature or whatever, just follow these simple steps:

  1. Create an issue for it.
  2. Fork the repo.
  3. Make your changes.
  4. Commit and create a pull request.
  5. Be happy :)

Contact me

If you have questions, or just want to send your love/hate, drop me an e-mail at: [email protected] Or visit my official site at www.fernandodoglio.com

License

The MIT License (MIT)

Copyright (c) 2013 Fernando Doglio

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.