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

express-admin-area

v0.6.4

Published

Django admin area but for Express

Downloads

41

Readme

Express Admin Area

PRs Welcome Version 0.6.3

The problem

While developers tend to live in the command line that doesn't mean everyone on the team likes to. Whether this is a non-technical member of the team or even another fellow developer.

This solution

Express Admin Area is a GUI in the browser for Database Administration tasks, Database Administration Interface (DBAI), that lets you and your team manage your database right from the browser.

Feel free to checkout this example repo that has the minimum requirements to use this package.

Table of Contents

Usage

Express Admin Area is extremely simple to use. All you need to do is

  • Install it as a dependency: yarn add express-admin-area or npm install express-admin area

  • Create a super user from the command line: yarn run express-admin-area <<full database url>> or npm run express-admin-area <<full database url>>.

  • Require Express Admin Area in your project and pass it a reference to your server, database using Sequelize, and an object containing the models in your database.

connection.js

/**
 * This is our connection.js file that will handle the connection of our server
 * layer to the database layer. Using Sequelize this is not only easily achieved
 * but we can rest assured that our queries are also safe
 */
// require our .env variables
require('dotenv').config()

const Sequelize = require('sequelize')

// create a connection to our DB
const db = new Sequelize(process.env.DB_URL, { operatorAliases: false })

module.exports = db

Electronics.js

/**
 * Now that our server and database are connected we need to create some models
 */
const Sequelize = require('sequelize')

const db = require('../connection')

// define our Electronics table
const Electronics = db.define(
  'electronics',  // name of our table in the DB
  {
    name: Sequelize.STRING,  // name field with a type of string
    price: Sequelize.INTEGER  // price field with a type of integer
  }
)

module.exports = Electronics

app.js

/**
 * Lastly, after connecting our database and creating our Electronics model to store
 * information about all of our electronics, we now need to pass this information
 * to ExpressAdminArea through the "init" method from ExpressAdminArea
 */
// require our .env variables
require('dotenv').config()

// our projects dependencies: express, express-admin-area
const express = require('express')
const ExpressAdminArea = require('express-admin-area')

const db = require('./database/connection')
// be sure to require your Sequelize models
const Electronics = require('./database/models/Electronics')

const app = express()

/**
 * Call the 'init' method from ExpressAdminArea passing in: express, databaseURI,
 * and an object containing all of your apps Sequelize models that you would like
 * to interact with using ExpressAdminArea
 */
const expressAdminArea = ExpressAdminArea.init(
  express,  // pass a reference to your apps instance of express
  process.env.DB_URL,  // databaseURI to your apps database
  [{ model: Electronics }]  // array of objects containing your apps Sequelize models
)

/**
 * Tell your app you would like to "use" ExpressAdminArea as a middleware
 * This will automatically create a new route at "https://myapp.com/expressadminarea"
 * where you can sign-in and begin interacting with your database from the browser
 */
app.use(expressAdminArea)

// tell your app to create your "electronics" table in the database if it does not exist
Electronics.sync()

// give your app an open port to start accepting requests from
app.listen(3000, () => console.log('\n\nServer Online\n\n'))

Viola! Now visit https://myapp.com/expressadminarea in your browser. Log in with your superuser credentials and you should be ready to manage your database from the browser.

Inspiration

Django's admin interface

Contributing

A good explanaiton of how to contribute to Express Admin Area can be found in the Contributing.md file.

Contributors

| Brandon Benefield | |------------------------------------------------------------------------------------------------------------------------------------------------------------|

LICENSE

MIT