-
Notifications
You must be signed in to change notification settings - Fork 8
Create app
Alexey Gordeyev edited this page Aug 17, 2014
·
40 revisions
- Create Default Application
- Create Application with Theme
- Create Application with session
- Create Application with authorization
# Create application
$ trinte -i HelloWorld
# intall dependencies
$ cd HelloWorld && npm -l install
# generate scaffold
$ trinte -g crud User active:bool name email password
# running server
$ trinte -s
- Browse your application to http://localhost:3000
On initialization directories tree generated, like that
Available 7 themes default
, black
, blue
, green
, orange
, pink
, violet
. Default theme violet
.
# add `--theme` argument
$ trinte -i HelloWorld --theme default
See themes here.
# add `--sess` argument
$ trinte -i HelloWorld --sess
Will be the following changes:
- Add deps to
connect-caminte
module - Rewrite file
/config/session.js
code here
$ trinte -i HelloWorld --auth
- Add deps to
trinte-auth
,passport
andpassport-local
modules - Add file
/config/authorization/local.js
code here - Rewrite file
/config/routes.js
var Auth = require('./authorization/local');
module.exports = function routes(map) {
// default login page
map.all( "/login", "apps#login" );
// default logout route
map.all( "/logout", Auth.logOut( '/' ) );
// add middleware
map.resources( "posts", {
middleware: [Auth.isLoggedIn( '/login')]
} );
});
$ trinte -i HelloWorld --uploader
- Add deps to
express-uploader
,gm
andnode-uuid
modules - Add file
/config/addons/uploader.js
code here - Rewrite file
/config/routes.js
var Uploader = require('./addons/uploader');
module.exports = function routes(map) {
map.post('/uploading', Uploader.middleware());
});
$ trinte -i HelloWorld --recaptcha
- Add deps to
recaptcha
module - Add file
/config/addons/recaptcha.js
code here - Rewrite file
/config/routes.js
var Recaptcha = require('./addons/recaptcha');
module.exports = function routes(map) {
/**
* recapcha middleware usage Recaptcha.middleware()
**/
});
$ trinte -i HelloWorld --mailer
- Add deps to
nodemailer
module - Add file
/config/addons/mailer.js
code here - Rewrite file
/config/routes.js
var Mail = require('./addons/mailer');
module.exports = function routes(map) {
map.post('/sendmail', Mail.mailSender());
});