# resourcejs-admin

> description here

Latest version **1.0.3** (published 2017-02-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install resourcejs-admin
pnpm add resourcejs-admin
yarn add resourcejs-admin
bun add resourcejs-admin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2017-02-14 |
| First published | 2017-02-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | coderofsalvation |

## Links

- npm: https://www.npmjs.com/package/resourcejs-admin
- Repository: https://github.com/coderofsalvation/resourcejs-admin
- Homepage: https://github.com/coderofsalvation/resourcejs-admin#readme
- Issues: https://github.com/coderofsalvation/resourcejs-admin/issues
- npm.io page: https://npm.io/package/resourcejs-admin

## Dependencies (8)

- [basic-auth](https://npm.io/package/basic-auth.md) ^1.1.0
- [resourcejs](https://npm.io/package/resourcejs.md) ^1.6.1
- [swagger-ui](https://npm.io/package/swagger-ui.md) ^2.2.8
- [body-parser](https://npm.io/package/body-parser.md) ^1.15.2
- [cookie-parser](https://npm.io/package/cookie-parser.md) ^1.4.3
- [mongooseadmin](https://npm.io/package/mongooseadmin.md) ^1.0.5
- [express-session](https://npm.io/package/express-session.md) ^1.14.2
- [generate-schema](https://npm.io/package/generate-schema.md) ^2.3.3

## Recent versions

- 1.0.3 (latest) — 2017-02-14
- 1.0.2 — 2017-02-14
- 1.0.1 — 2017-02-14

## README

minimalistic Express.js library which turns one json-model into: mongoose models,  REST endpoints,  documentation & admin interface

![Build Status](https://travis-ci.org/coderofsalvation/resourcejs-admin..svg?branch=master)

![](https://raw.githubusercontent.com/coderofsalvation/resourcejs-admin/master/demo.gif)

## Usage

    $ npm install mongoose resourcejs-admin express

then setup your express app like so:

    var express = require('express')
    var port = process.env.PORT || 3000
    var mongoose = require('mongoose')
    var config = require('./config.json')

    mongoose.connect('mongodb://localhost/myapp'); 

    // Create a new Express application.
    app = express()

    // Setup database / rest endpoints / documentation / admin
    require('resourcejs-admin')(express, app, config, 
      function(schema, name, config){  }   // you can decorate the mongoose schema's further here (http://mongoosejs.com/docs/2.7.x/docs/schematypes.html)
      function(swagger){ }                 // you can decorate the swagger-spec here to extend the docs served at /doc
    })

    app.listen(port)

and `config.json` like so:

    {
      "title":"My app", 
      "logo":"/img/logo.png", 
      "users":{
        "admin": {"password":"password"}
      }, 
      "database":{
        "user":{
          "data":{
            "id": 1234, 
            "username":"johndoe", 
            "email":"john@doe.com", 
            "displayName":"John Doe", 
            "data":{}
          }, 
          "rest":["get", "post", "put", "delete", "index"]
        }, 
        "game":{
          "data":{
            "repository":"http://github.com/foo/bar", 
            "issues":[1234, 143453, 1345]
          }, 
          "rest":["get", "post", "put", "delete", "index"]
        }
      }
    }

## Features

* rest endpoints served basic on mongoose schemas (which are extracted from data in `config.json`)
* easy configurable database schema by putting data-mocks into `config.json` 
* documentation served at `/doc`
* admin panel served at `/admin`
* basic http authentication (in progress)

---
_Source: https://npm.io/package/resourcejs-admin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
