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

roosevelt

Package Overview
Dependencies
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

roosevelt

Roosevelt MVC web framework

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
210
increased by311.76%
Maintainers
1
Weekly downloads
 
Created
Source

roosevelt.js

Roosevelt is a web framework for Node.js which uses teddy.js for HTML templating.

Built on Express, Roosevelt abstracts most of Express' boilerplate, sets sane defaults with mechanisms for override, and provides a uniform MVC structure for your app.

Installation

Install command line tool globally (may require sudo):

npm install -g roosevelt

Make an app

Use the command line tool to create a sample app:

roosevelt create myapp

Change into your new app's directory and then install dependencies (may require sudo):

cd myapp
npm install .

Run the app:

node .

That's pretty much it.

What's in app.js?

Just this:

var app = require('roosevelt')({
  /**
   * params:
   * 
   * param name:      default value
   * name:            'Roosevelt Express'
   * port:            43711
   * controllersPath: 'mvc/controllers/'
   * viewsPath:       'mvc/views/'
   * imagesPath:      'statics/i/'
   * cssPath:         'statics/css/'
   * jsPath:          'statics/js/'
   * customConfigs:   function() { put custom Express config code here }
   */
});

Roosevelt is designed to have a minimal amount of boilerplate so you can focus on just writing your app. All params are optional.

Params

Here's what the params mean:

  • name: the name of your app
  • port: the port your app will run on (default is 43711)
  • controllersPath: path on filesystem to where your controller files are located (default is "mvc/controllers")
  • viewsPath: path on filesystem to where your view files are located (default is "mvc/views")
  • imagesPath: path on filesystem to where your image files are located (default is "statics/i")
  • cssPath: path on filesystem to where your CSS files are located (default is "statics/css")
  • jsPath: path on filesystem to where your JS files are located (default is "statics/js")
  • customConfigs: use this to define a custom function to be executed during the Express config stage if you need one

How do I make new routes?

URL endpoints are defined by controller files.

The Roosevelt framework will automatically assign a route matching each controller's filename.

As such, to make a new route, just make a new file in the controllers directory.

For example, suppose we make a new file in mvc/controllers called hello.js:

module.exports = function(req, res) {
  res.render('hello.html', require('../models/helloModel'));
};

That will make a new URL endpoint called "hello" on your app which will attempt to render a template in the mvc/views directory called hello.html and pass a model from the mvc/models directory called helloModel.js.

Missing features

Here are some things still left to be implemented:

  • Support for templating engines other than teddy
  • HTTPS support
  • Support for more custom HTTP status code error pages
  • Probably many other things

Dependencies

  • fs (bundled with Node.js) - a default Node.js module which provides filesystem access
  • http (bundled with Node.js) - a default Node.js module which provides HTTP web server support
  • express - a minimal and flexible node.js web application framework
  • teddy - an easy-to-read, HTML-based, mostly logic-less DOM templating engine
  • wrench - used by the CLI tool to help you create your sample app

License

All original code in Roosevelt is licensed under the Creative Commons Attribution 3.0 Unported License. Commercial and noncommercial use is permitted with attribution.

Keywords

FAQs

Package last updated on 04 Mar 2013

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