Skip to content

Instantly share code, notes, and snippets.

@negamorgan
Created May 28, 2015 15:22
Show Gist options
  • Save negamorgan/00c3c7a6f1e6b3571e6c to your computer and use it in GitHub Desktop.
Save negamorgan/00c3c7a6f1e6b3571e6c to your computer and use it in GitHub Desktop.
How to basic Sails.js CMS
npm install -g sails
sails new someAppName && cd someAppName
npm install --save sails-hook-adminpanel jade sails-mysql # or sails-mongo or sails-postgresql
touch config/adminpanel.js # TODO draw the rest of the owl here...
# in config/views.js, set 'engine' to 'jade'
mysql -uroot # only if you need a new mysql user
CREATE USER 'testuser'@'localhost'; # only if you need a new mysql user
GRANT ALL PRIVILEGES ON * . * TO 'testuser'@'localhost'; # only if you need a new mysql user
exit; # only if you need a new mysql user
mysql -u testuser
CREATE DATABASE testdb;
exit;
mysql -u testuser testdb < /dump/file.sql # only if you want to import an existing mysql database
# in config/connections.js, add mysql db info
# in config/models.js, uncomment 'connection' and add connection name from previous step
# also uncomment 'migrate' and set to 'alter'
sails generate model kitten name:string
sails generate controller kitten index create show edit delete
open localhost:1337/admin/kitten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment