https://github.com/coderofsalvation/resourcejs-admin
minimalistic Express.js library which turns one json-model into: mongoose models, REST endpoints, documentation & admin interface
https://github.com/coderofsalvation/resourcejs-admin
Last synced: about 1 year ago
JSON representation
minimalistic Express.js library which turns one json-model into: mongoose models, REST endpoints, documentation & admin interface
- Host: GitHub
- URL: https://github.com/coderofsalvation/resourcejs-admin
- Owner: coderofsalvation
- License: other
- Created: 2017-02-14T09:33:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-28T19:25:13.000Z (about 6 years ago)
- Last Synced: 2024-12-27T19:33:19.974Z (over 1 year ago)
- Language: JavaScript
- Size: 4 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
minimalistic Express.js library which turns one json-model into: mongoose models, REST endpoints, documentation & admin interface


## 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)