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

sequelize-admin

v0.0.0

Published

A connect module for managing database entries of registered sequelize models.

Downloads

15

Readme

sequelize-admin

A connect module for managing database entries of registered sequelize models.

Look & Feel

The initial view will show you all the available models + it's instances:

Build Status

Getting started

The idea behind sequelize-admin is to have a drop-in, easy-to-use CMS-like admin panel, which allows the creation, deletion and modification of database entries. The application needs to be based on connect or express and should use sequelize. To add the module to your existing application, you just have to add the following line:

app.use(admin(sequelize))

This will make the admin area available under http://your.app/admin. sequelize-admin is depending on the module sequelize-restful, which transforms a sequelize instance into a RESTful interface. If your are already using sequelize-restful, you need to tell sequelize-admin where it can find the REST API. If you don't define that option, the admin panel will create it's own instance of the REST interface.

// default of restful: true
app.use(admin(sequelize, { restful: '/my/path/to/the/rest/api' }))

In addition to that, you might need to protect your API against external request. This is where sequelize-authentication comes into play. The module will take parameters of a request to authenticate against your database. If you want to use that, you have to give sequelize-admin a small hint:

// default of authentication: false

// passing true will assume, that no param options is used 
// and that the credentials are passed via params mode.
app.use(admin(sequelize, { authentication: true }))

// define the relevant options of authentication
app.use(admin(sequelize, { 
	authentication: {
		param: 'credentials',
		via:   'headers'
	}
}))

In total, you will end up with something like this:

var app            = express()
  , authentication = require('sequelize-authentication')
  , restful        = require('sequelize-restful)
  , admin          = require('sequelize-admin')
  , Sequelize      = require('sequelize')
  , sequelize      = new Sequelize('database', 'user', 'password')

app.configure(function() {
	app.use(authenticate(sequelize, { 
		via: 'headers', 
		scope: '/admin/api', 
		param: 'credentials' 
	}))
  
	app.use(restful(sequelize, { endpoint: '/admin/api' }))

	app.use(admin(sequelize, {
		endpoint: '/admin',
		restful:  '/admin/api',
		authentication: {
			via: 'headers', 
			param: 'credentials' 
		}
	}))
})

If you just skip all the options and only use admin(sequelize), you will get an admin panel which is located under http://your.app/admin, with a RESTful API under http://your.app/admin/api and without any protection of that API.

Develompent notes

Updating dependencies

Dependencies are managed with bower. Check the documentation to get details about updating components. The respective component.json is located under app/js/component.json. In order to update a new component, you have to do this:

cd app/js
bower install <component>

After updating bootstrap you need to run the following command:

npm run amdify-bootstrap