sails-hook-adminx
Sails hook for AdminX. Manage your sails app data without coding.
What's AdminX?
AdminX is a universal, fast and reliable admin panel.
Sample app
We open sourced the demo app we use on the website:
Sails Demo Code
Requirements
- Sails >0.12 or >1.0
- Waterline: this integrations requires you to use the default Sails ORM
What does sails-hook-adminx do under the bonnet?
- Initializes on
sails lift
as the sails-hook-adminx
- Exposes a REST API under
/adminx/*
- Adds CORS (Cross Origin Resource Sharing) configuration to open access from AdminX-served-pages on your browser to your servers (https://adminx.io)
An AdminX Panel is then able to connect from your browser to your server securely.
Install
# npm install sails-hook-adminx --save
yarn add sails-hook-adminx@^0.1.2 # Sails 1.0
# or
yarn add sails-hook-adminx@^0.0.10 # Sails 0.12
Configure
Create a config/adminx.js
file
module.exports.adminx = {
authEnabled: true,
dataAuthToken: 'REPLACE_THIS_TOKEN'
};
Usage
In your models, you can now define an adminx
attribute with the adminx configurations you need.
module.exports = {
attributes: {
model: { type:'string' },
brand: { model: 'brand' },
year: { type: 'integer', min: 2000, max: 2019 },
dailyRate: { type: 'float', min: 0 },
availableAt: { type: 'date' },
fullTank: { type: 'boolean' },
summary: { type: 'mediumtext' },
thumbnail: { type: 'string' },
cover: { type: 'string' },
extras: { type: 'array' },
doorConfiguration: {
type: 'string',
enum: ['2 Doors', '3 Doors', '4 Doors', '5 Doors', '6 Doors']
},
history: { type: 'longtext' },
metaData: { type: 'json' },
},
adminx: {
name: 'Car',
attributes: {
id: { disabled: true },
thumbnail: { list: true, editor: 'image' },
brand: { },
model: { list: true },
summary: { },
cover: { editor: 'image' },
history: { editor: 'html-simple' },
updatedAt: { list: true },
}
}
};
Resources
License
MIT License Copyright © 2016-2017 Albert Peiro, ADMINX LTD.