Setup DB Structure using Models in Sails.js

This commit is contained in:
Patrick McDonagh
2016-04-27 09:39:02 -05:00
parent 4a867430ac
commit 80d965dfcc
84 changed files with 5061 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

5
tagserverApp/.sailsrc Normal file
View File

@@ -0,0 +1,5 @@
{
"generators": {
"modules": {}
}
}

81
tagserverApp/Gruntfile.js Normal file
View File

@@ -0,0 +1,81 @@
/**
* Gruntfile
*
* This Node script is executed when you run `grunt` or `sails lift`.
* It's purpose is to load the Grunt tasks in your project's `tasks`
* folder, and allow you to add and remove tasks as you see fit.
* For more information on how this works, check out the `README.md`
* file that was generated in your `tasks` folder.
*
* WARNING:
* Unless you know what you're doing, you shouldn't change this file.
* Check out the `tasks` directory instead.
*/
module.exports = function(grunt) {
// Load the include-all library in order to require all of our grunt
// configurations and task registrations dynamically.
var includeAll;
try {
includeAll = require('include-all');
} catch (e0) {
try {
includeAll = require('sails/node_modules/include-all');
}
catch(e1) {
console.error('Could not find `include-all` module.');
console.error('Skipping grunt tasks...');
console.error('To fix this, please run:');
console.error('npm install include-all --save`');
console.error();
grunt.registerTask('default', []);
return;
}
}
/**
* Loads Grunt configuration modules from the specified
* relative path. These modules should export a function
* that, when run, should either load/configure or register
* a Grunt task.
*/
function loadTasks(relPath) {
return includeAll({
dirname: require('path').resolve(__dirname, relPath),
filter: /(.+)\.js$/
}) || {};
}
/**
* Invokes the function from a Grunt configuration module with
* a single argument - the `grunt` object.
*/
function invokeConfigFn(tasks) {
for (var taskName in tasks) {
if (tasks.hasOwnProperty(taskName)) {
tasks[taskName](grunt);
}
}
}
// Load task functions
var taskConfigurations = loadTasks('./tasks/config'),
registerDefinitions = loadTasks('./tasks/register');
// (ensure that a default task exists)
if (!registerDefinitions.default) {
registerDefinitions.default = function (grunt) { grunt.registerTask('default', []); };
}
// Run task functions to configure Grunt.
invokeConfigFn(taskConfigurations);
invokeConfigFn(registerDefinitions);
};

3
tagserverApp/README.md Normal file
View File

@@ -0,0 +1,3 @@
# tagserverApp
a [Sails](http://sailsjs.org) application

View File

View File

@@ -0,0 +1,11 @@
/**
* Data_typeController
*
* @description :: Server-side logic for managing data_types
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
};

View File

@@ -0,0 +1,11 @@
/**
* DeviceController
*
* @description :: Server-side logic for managing devices
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
};

View File

@@ -0,0 +1,11 @@
/**
* Device_typeController
*
* @description :: Server-side logic for managing device_types
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
};

View File

@@ -0,0 +1,11 @@
/**
* TagController
*
* @description :: Server-side logic for managing tags
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
};

View File

@@ -0,0 +1,11 @@
/**
* Tag_classController
*
* @description :: Server-side logic for managing tag_classes
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
};

View File

@@ -0,0 +1,11 @@
/**
* Tag_valController
*
* @description :: Server-side logic for managing tag_vals
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
};

View File

View File

@@ -0,0 +1,23 @@
/**
* Data_type.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
connection: 'mysqlDb',
tableName: 'data_types',
attributes: {
id: {
type: 'integer',
unique: true,
autoIncrement: true,
primaryKey: true
},
data_type: {
type: 'string',
unique: true
}
}
};

View File

@@ -0,0 +1,26 @@
/**
* Device.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
connection: 'mysqlDb',
tableName: 'devices',
attributes: {
id: {
type: 'integer',
unique: true,
autoIncrement: true,
primaryKey: true
},
device_type: {
model: 'device_type',
columnName: 'device_type'
},
address: {
type: 'string'
}
}
};

View File

@@ -0,0 +1,23 @@
/**
* Device_type.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
connection: 'mysqlDb',
tableName: 'device_types',
attributes: {
id: {
type: 'integer',
unique: true,
autoIncrement: true,
primaryKey: true
},
dType: {
type: 'string',
unique: true
}
}
};

View File

@@ -0,0 +1,55 @@
/**
* Tag.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
connection: 'mysqlDb',
tableName: 'tags',
attributes: {
id: {
type: 'integer',
unique: true,
autoIncrement: true,
primaryKey: true
},
name: {
type: 'string'
},
tag_class: {
model:'tag_class'
},
tag: {
type: 'string'
},
deviceID: {
model:'device'
},
description: {
type: 'string'
},
data_type: {
model: 'data_type'
},
change_threshold: {
type: 'float'
},
guarantee_sec: {
type: 'integer'
},
map_function: {
type: 'string'
},
units:{
type: 'string'
},
minExpected: {
type: 'float'
},
maxExpected: {
type: 'float'
}
}
};

View File

@@ -0,0 +1,26 @@
/**
* Tag_class.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
connection: 'mysqlDb',
tableName: 'tag_classes',
attributes: {
id: {
type: 'integer',
unique: true,
autoIncrement: true,
primaryKey: true
},
class_type: {
type: 'string',
unique: true
},
description: {
type: 'string'
}
}
};

View File

@@ -0,0 +1,25 @@
/**
* Tag_val.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
connection: 'mysqlDb',
tableName: 'tag_vals',
attributes: {
id: {
type: 'integer',
unique: true,
autoIncrement: true,
primaryKey: true
},
tagID:{
model: 'tag'
},
val:{
type: 'float'
}
}
};

View File

@@ -0,0 +1,21 @@
/**
* sessionAuth
*
* @module :: Policy
* @description :: Simple policy to allow any authenticated user
* Assumes that your login action in one of your controllers sets `req.session.authenticated = true;`
* @docs :: http://sailsjs.org/#!/documentation/concepts/Policies
*
*/
module.exports = function(req, res, next) {
// User is allowed, proceed to the next policy,
// or if this is the last policy, the controller
if (req.session.authenticated) {
return next();
}
// User is not allowed
// (default res.forbidden() behavior can be overridden in `config/403.js`)
return res.forbidden('You are not permitted to perform this action.');
};

View File

@@ -0,0 +1,76 @@
/**
* 400 (Bad Request) Handler
*
* Usage:
* return res.badRequest();
* return res.badRequest(data);
* return res.badRequest(data, 'some/specific/badRequest/view');
*
* e.g.:
* ```
* return res.badRequest(
* 'Please choose a valid `password` (6-12 characters)',
* 'trial/signup'
* );
* ```
*/
module.exports = function badRequest(data, options) {
// Get access to `req`, `res`, & `sails`
var req = this.req;
var res = this.res;
var sails = req._sails;
// Set status code
res.status(400);
// Log error to console
if (data !== undefined) {
sails.log.verbose('Sending 400 ("Bad Request") response: \n',data);
}
else sails.log.verbose('Sending 400 ("Bad Request") response');
// Only include errors in response if application environment
// is not set to 'production'. In production, we shouldn't
// send back any identifying information about errors.
if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) {
data = undefined;
}
// If the user-agent wants JSON, always respond with JSON
// If views are disabled, revert to json
if (req.wantsJSON || sails.config.hooks.views === false) {
return res.jsonx(data);
}
// If second argument is a string, we take that to mean it refers to a view.
// If it was omitted, use an empty object (`{}`)
options = (typeof options === 'string') ? { view: options } : options || {};
// Attempt to prettify data for views, if it's a non-error object
var viewData = data;
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
try {
viewData = require('util').inspect(data, {depth: null});
}
catch(e) {
viewData = undefined;
}
}
// If a view was provided in options, serve it.
// Otherwise try to guess an appropriate view, or if that doesn't
// work, just send JSON.
if (options.view) {
return res.view(options.view, { data: viewData, title: 'Bad Request' });
}
// If no second argument provided, try to serve the implied view,
// but fall back to sending JSON(P) if no view can be inferred.
else return res.guessView({ data: viewData, title: 'Bad Request' }, function couldNotGuessView () {
return res.jsonx(data);
});
};

View File

@@ -0,0 +1,60 @@
/**
* 201 (CREATED) Response
*
* Usage:
* return res.created();
* return res.created(data);
* return res.created(data, 'auth/login');
*
* @param {Object} data
* @param {String|Object} options
* - pass string to render specified view
*/
module.exports = function created (data, options) {
// Get access to `req`, `res`, & `sails`
var req = this.req;
var res = this.res;
var sails = req._sails;
sails.log.silly('res.created() :: Sending 201 ("CREATED") response');
// Set status code
res.status(201);
// If appropriate, serve data as JSON(P)
// If views are disabled, revert to json
if (req.wantsJSON || sails.config.hooks.views === false) {
return res.jsonx(data);
}
// If second argument is a string, we take that to mean it refers to a view.
// If it was omitted, use an empty object (`{}`)
options = (typeof options === 'string') ? { view: options } : options || {};
// Attempt to prettify data for views, if it's a non-error object
var viewData = data;
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
try {
viewData = require('util').inspect(data, {depth: null});
}
catch(e) {
viewData = undefined;
}
}
// If a view was provided in options, serve it.
// Otherwise try to guess an appropriate view, or if that doesn't
// work, just send JSON.
if (options.view) {
return res.view(options.view, { data: viewData, title: 'Created' });
}
// If no second argument provided, try to serve the implied view,
// but fall back to sending JSON(P) if no view can be inferred.
else return res.guessView({ data: viewData, title: 'Created' }, function couldNotGuessView () {
return res.jsonx(data);
});
};

View File

@@ -0,0 +1,89 @@
/**
* 403 (Forbidden) Handler
*
* Usage:
* return res.forbidden();
* return res.forbidden(err);
* return res.forbidden(err, 'some/specific/forbidden/view');
*
* e.g.:
* ```
* return res.forbidden('Access denied.');
* ```
*/
module.exports = function forbidden (data, options) {
// Get access to `req`, `res`, & `sails`
var req = this.req;
var res = this.res;
var sails = req._sails;
// Set status code
res.status(403);
// Log error to console
if (data !== undefined) {
sails.log.verbose('Sending 403 ("Forbidden") response: \n',data);
}
else sails.log.verbose('Sending 403 ("Forbidden") response');
// Only include errors in response if application environment
// is not set to 'production'. In production, we shouldn't
// send back any identifying information about errors.
if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) {
data = undefined;
}
// If the user-agent wants JSON, always respond with JSON
// If views are disabled, revert to json
if (req.wantsJSON || sails.config.hooks.views === false) {
return res.jsonx(data);
}
// If second argument is a string, we take that to mean it refers to a view.
// If it was omitted, use an empty object (`{}`)
options = (typeof options === 'string') ? { view: options } : options || {};
// Attempt to prettify data for views, if it's a non-error object
var viewData = data;
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
try {
viewData = require('util').inspect(data, {depth: null});
}
catch(e) {
viewData = undefined;
}
}
// If a view was provided in options, serve it.
// Otherwise try to guess an appropriate view, or if that doesn't
// work, just send JSON.
if (options.view) {
return res.view(options.view, { data: viewData, title: 'Forbidden' });
}
// If no second argument provided, try to serve the default view,
// but fall back to sending JSON(P) if any errors occur.
else return res.view('403', { data: viewData, title: 'Forbidden' }, function (err, html) {
// If a view error occured, fall back to JSON(P).
if (err) {
//
// Additionally:
// • If the view was missing, ignore the error but provide a verbose log.
if (err.code === 'E_VIEW_FAILED') {
sails.log.verbose('res.forbidden() :: Could not locate view for error page (sending JSON instead). Details: ',err);
}
// Otherwise, if this was a more serious error, log to the console with the details.
else {
sails.log.warn('res.forbidden() :: When attempting to render error page view, an error occured (sending JSON instead). Details: ', err);
}
return res.jsonx(data);
}
return res.send(html);
});
};

View File

@@ -0,0 +1,94 @@
/**
* 404 (Not Found) Handler
*
* Usage:
* return res.notFound();
* return res.notFound(err);
* return res.notFound(err, 'some/specific/notfound/view');
*
* e.g.:
* ```
* return res.notFound();
* ```
*
* NOTE:
* If a request doesn't match any explicit routes (i.e. `config/routes.js`)
* or route blueprints (i.e. "shadow routes", Sails will call `res.notFound()`
* automatically.
*/
module.exports = function notFound (data, options) {
// Get access to `req`, `res`, & `sails`
var req = this.req;
var res = this.res;
var sails = req._sails;
// Set status code
res.status(404);
// Log error to console
if (data !== undefined) {
sails.log.verbose('Sending 404 ("Not Found") response: \n',data);
}
else sails.log.verbose('Sending 404 ("Not Found") response');
// Only include errors in response if application environment
// is not set to 'production'. In production, we shouldn't
// send back any identifying information about errors.
if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) {
data = undefined;
}
// If the user-agent wants JSON, always respond with JSON
// If views are disabled, revert to json
if (req.wantsJSON || sails.config.hooks.views === false) {
return res.jsonx(data);
}
// If second argument is a string, we take that to mean it refers to a view.
// If it was omitted, use an empty object (`{}`)
options = (typeof options === 'string') ? { view: options } : options || {};
// Attempt to prettify data for views, if it's a non-error object
var viewData = data;
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
try {
viewData = require('util').inspect(data, {depth: null});
}
catch(e) {
viewData = undefined;
}
}
// If a view was provided in options, serve it.
// Otherwise try to guess an appropriate view, or if that doesn't
// work, just send JSON.
if (options.view) {
return res.view(options.view, { data: viewData, title: 'Not Found' });
}
// If no second argument provided, try to serve the default view,
// but fall back to sending JSON(P) if any errors occur.
else return res.view('404', { data: viewData, title: 'Not Found' }, function (err, html) {
// If a view error occured, fall back to JSON(P).
if (err) {
//
// Additionally:
// • If the view was missing, ignore the error but provide a verbose log.
if (err.code === 'E_VIEW_FAILED') {
sails.log.verbose('res.notFound() :: Could not locate view for error page (sending JSON instead). Details: ',err);
}
// Otherwise, if this was a more serious error, log to the console with the details.
else {
sails.log.warn('res.notFound() :: When attempting to render error page view, an error occured (sending JSON instead). Details: ', err);
}
return res.jsonx(data);
}
return res.send(html);
});
};

View File

@@ -0,0 +1,60 @@
/**
* 200 (OK) Response
*
* Usage:
* return res.ok();
* return res.ok(data);
* return res.ok(data, 'auth/login');
*
* @param {Object} data
* @param {String|Object} options
* - pass string to render specified view
*/
module.exports = function sendOK (data, options) {
// Get access to `req`, `res`, & `sails`
var req = this.req;
var res = this.res;
var sails = req._sails;
sails.log.silly('res.ok() :: Sending 200 ("OK") response');
// Set status code
res.status(200);
// If appropriate, serve data as JSON(P)
// If views are disabled, revert to json
if (req.wantsJSON || sails.config.hooks.views === false) {
return res.jsonx(data);
}
// If second argument is a string, we take that to mean it refers to a view.
// If it was omitted, use an empty object (`{}`)
options = (typeof options === 'string') ? { view: options } : options || {};
// Attempt to prettify data for views, if it's a non-error object
var viewData = data;
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
try {
viewData = require('util').inspect(data, {depth: null});
}
catch(e) {
viewData = undefined;
}
}
// If a view was provided in options, serve it.
// Otherwise try to guess an appropriate view, or if that doesn't
// work, just send JSON.
if (options.view) {
return res.view(options.view, { data: viewData, title: 'OK' });
}
// If no second argument provided, try to serve the implied view,
// but fall back to sending JSON(P) if no view can be inferred.
else return res.guessView({ data: viewData, title: 'OK' }, function couldNotGuessView () {
return res.jsonx(data);
});
};

View File

@@ -0,0 +1,89 @@
/**
* 500 (Server Error) Response
*
* Usage:
* return res.serverError();
* return res.serverError(err);
* return res.serverError(err, 'some/specific/error/view');
*
* NOTE:
* If something throws in a policy or controller, or an internal
* error is encountered, Sails will call `res.serverError()`
* automatically.
*/
module.exports = function serverError (data, options) {
// Get access to `req`, `res`, & `sails`
var req = this.req;
var res = this.res;
var sails = req._sails;
// Set status code
res.status(500);
// Log error to console
if (data !== undefined) {
sails.log.error('Sending 500 ("Server Error") response: \n',data);
}
else sails.log.error('Sending empty 500 ("Server Error") response');
// Only include errors in response if application environment
// is not set to 'production'. In production, we shouldn't
// send back any identifying information about errors.
if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) {
data = undefined;
}
// If the user-agent wants JSON, always respond with JSON
// If views are disabled, revert to json
if (req.wantsJSON || sails.config.hooks.views === false) {
return res.jsonx(data);
}
// If second argument is a string, we take that to mean it refers to a view.
// If it was omitted, use an empty object (`{}`)
options = (typeof options === 'string') ? { view: options } : options || {};
// Attempt to prettify data for views, if it's a non-error object
var viewData = data;
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
try {
viewData = require('util').inspect(data, {depth: null});
}
catch(e) {
viewData = undefined;
}
}
// If a view was provided in options, serve it.
// Otherwise try to guess an appropriate view, or if that doesn't
// work, just send JSON.
if (options.view) {
return res.view(options.view, { data: viewData, title: 'Server Error' });
}
// If no second argument provided, try to serve the default view,
// but fall back to sending JSON(P) if any errors occur.
else return res.view('500', { data: viewData, title: 'Server Error' }, function (err, html) {
// If a view error occured, fall back to JSON(P).
if (err) {
//
// Additionally:
// • If the view was missing, ignore the error but provide a verbose log.
if (err.code === 'E_VIEW_FAILED') {
sails.log.verbose('res.serverError() :: Could not locate view for error page (sending JSON instead). Details: ',err);
}
// Otherwise, if this was a more serious error, log to the console with the details.
else {
sails.log.warn('res.serverError() :: When attempting to render error page view, an error occured (sending JSON instead). Details: ', err);
}
return res.jsonx(data);
}
return res.send(html);
});
};

View File

59
tagserverApp/app.js Normal file
View File

@@ -0,0 +1,59 @@
/**
* app.js
*
* Use `app.js` to run your app without `sails lift`.
* To start the server, run: `node app.js`.
*
* This is handy in situations where the sails CLI is not relevant or useful.
*
* For example:
* => `node app.js`
* => `forever start app.js`
* => `node debug app.js`
* => `modulus deploy`
* => `heroku scale`
*
*
* The same command-line arguments are supported, e.g.:
* `node app.js --silent --port=80 --prod`
*/
// Ensure we're in the project directory, so relative paths work as expected
// no matter where we actually lift from.
process.chdir(__dirname);
// Ensure a "sails" can be located:
(function() {
var sails;
try {
sails = require('sails');
} catch (e) {
console.error('To run an app using `node app.js`, you usually need to have a version of `sails` installed in the same directory as your app.');
console.error('To do that, run `npm install sails`');
console.error('');
console.error('Alternatively, if you have sails installed globally (i.e. you did `npm install -g sails`), you can use `sails lift`.');
console.error('When you run `sails lift`, your app will still use a local `./node_modules/sails` dependency if it exists,');
console.error('but if it doesn\'t, the app will run with the global sails instead!');
return;
}
// Try to get `rc` dependency
var rc;
try {
rc = require('rc');
} catch (e0) {
try {
rc = require('sails/node_modules/rc');
} catch (e1) {
console.error('Could not find dependency: `rc`.');
console.error('Your `.sailsrc` file(s) will be ignored.');
console.error('To resolve this, run:');
console.error('npm install rc --save');
rc = function () { return {}; };
}
}
// Start server
sails.lift(rc('sails'));
})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

View File

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
# The robots.txt file is used to control how search engines index your live URLs.
# See http://sailsjs.org/documentation/anatomy/my-app/assets/robots-txt for more information.
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
# User-Agent: *
# Disallow: /

View File

@@ -0,0 +1,30 @@
/**
* importer.less
*
* By default, new Sails projects are configured to compile this file
* from LESS to CSS. Unlike CSS files, LESS files are not compiled and
* included automatically unless they are imported below.
*
* The LESS files imported below are compiled and included in the order
* they are listed. Mixins, variables, etc. should be imported first
* so that they can be accessed by subsequent LESS stylesheets.
*
* (Just like the rest of the asset pipeline bundled in Sails, you can
* always omit, customize, or replace this behavior with SASS, SCSS,
* or any other Grunt tasks you like.)
*/
// For example:
//
// @import 'variables/colors.less';
// @import 'mixins/foo.less';
// @import 'mixins/bar.less';
// @import 'mixins/baz.less';
//
// @import 'styleguide.less';
// @import 'pages/login.less';
// @import 'pages/signup.less';
//
// etc.

View File

View File

@@ -0,0 +1,162 @@
/**
* Blueprint API Configuration
* (sails.config.blueprints)
*
* These settings are for the global configuration of blueprint routes and
* request options (which impact the behavior of blueprint actions).
*
* You may also override any of these settings on a per-controller basis
* by defining a '_config' key in your controller definition, and assigning it
* a configuration object with overrides for the settings in this file.
* A lot of the configuration options below affect so-called "CRUD methods",
* or your controllers' `find`, `create`, `update`, and `destroy` actions.
*
* It's important to realize that, even if you haven't defined these yourself, as long as
* a model exists with the same name as the controller, Sails will respond with built-in CRUD
* logic in the form of a JSON API, including support for sort, pagination, and filtering.
*
* For more information on the blueprint API, check out:
* http://sailsjs.org/#!/documentation/reference/blueprint-api
*
* For more information on the settings in this file, see:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.blueprints.html
*
*/
module.exports.blueprints = {
/***************************************************************************
* *
* Action routes speed up the backend development workflow by *
* eliminating the need to manually bind routes. When enabled, GET, POST, *
* PUT, and DELETE routes will be generated for every one of a controller's *
* actions. *
* *
* If an `index` action exists, additional naked routes will be created for *
* it. Finally, all `actions` blueprints support an optional path *
* parameter, `id`, for convenience. *
* *
* `actions` are enabled by default, and can be OK for production-- *
* however, if you'd like to continue to use controller/action autorouting *
* in a production deployment, you must take great care not to *
* inadvertently expose unsafe/unintentional controller logic to GET *
* requests. *
* *
***************************************************************************/
// actions: true,
/***************************************************************************
* *
* RESTful routes (`sails.config.blueprints.rest`) *
* *
* REST blueprints are the automatically generated routes Sails uses to *
* expose a conventional REST API on top of a controller's `find`, *
* `create`, `update`, and `destroy` actions. *
* *
* For example, a BoatController with `rest` enabled generates the *
* following routes: *
* ::::::::::::::::::::::::::::::::::::::::::::::::::::::: *
* GET /boat -> BoatController.find *
* GET /boat/:id -> BoatController.findOne *
* POST /boat -> BoatController.create *
* PUT /boat/:id -> BoatController.update *
* DELETE /boat/:id -> BoatController.destroy *
* *
* `rest` blueprint routes are enabled by default, and are suitable for use *
* in a production scenario, as long you take standard security precautions *
* (combine w/ policies, etc.) *
* *
***************************************************************************/
// rest: true,
/***************************************************************************
* *
* Shortcut routes are simple helpers to provide access to a *
* controller's CRUD methods from your browser's URL bar. When enabled, *
* GET, POST, PUT, and DELETE routes will be generated for the *
* controller's`find`, `create`, `update`, and `destroy` actions. *
* *
* `shortcuts` are enabled by default, but should be disabled in *
* production. *
* *
***************************************************************************/
// shortcuts: true,
/***************************************************************************
* *
* An optional mount path for all blueprint routes on a controller, *
* including `rest`, `actions`, and `shortcuts`. This allows you to take *
* advantage of blueprint routing, even if you need to namespace your API *
* methods. *
* *
* (NOTE: This only applies to blueprint autoroutes, not manual routes from *
* `sails.config.routes`) *
* *
***************************************************************************/
// prefix: '',
/***************************************************************************
* *
* An optional mount path for all REST blueprint routes on a controller. *
* And it do not include `actions` and `shortcuts` routes. *
* This allows you to take advantage of REST blueprint routing, *
* even if you need to namespace your RESTful API methods *
* *
***************************************************************************/
// restPrefix: '',
/***************************************************************************
* *
* Whether to pluralize controller names in blueprint routes. *
* *
* (NOTE: This only applies to blueprint autoroutes, not manual routes from *
* `sails.config.routes`) *
* *
* For example, REST blueprints for `FooController` with `pluralize` *
* enabled: *
* GET /foos/:id? *
* POST /foos *
* PUT /foos/:id? *
* DELETE /foos/:id? *
* *
***************************************************************************/
// pluralize: false,
/***************************************************************************
* *
* Whether the blueprint controllers should populate model fetches with *
* data from other models which are linked by associations *
* *
* If you have a lot of data in one-to-many associations, leaving this on *
* may result in very heavy api calls *
* *
***************************************************************************/
// populate: true,
/****************************************************************************
* *
* Whether to run Model.watch() in the find and findOne blueprint actions. *
* Can be overridden on a per-model basis. *
* *
****************************************************************************/
// autoWatch: true,
/****************************************************************************
* *
* The default number of records to show in the response from a "find" *
* action. Doubles as the default size of populated arrays if populate is *
* true. *
* *
****************************************************************************/
// defaultLimit: 30
};

17
tagserverApp/config/bootstrap.js vendored Normal file
View File

@@ -0,0 +1,17 @@
/**
* Bootstrap
* (sails.config.bootstrap)
*
* An asynchronous bootstrap function that runs before your Sails app gets lifted.
* This gives you an opportunity to set up your data model, run jobs, or perform some special logic.
*
* For more information on bootstrapping your app, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.bootstrap.html
*/
module.exports.bootstrap = function(cb) {
// It's very important to trigger this callback method when you are finished
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap)
cb();
};

View File

@@ -0,0 +1,92 @@
/**
* Connections
* (sails.config.connections)
*
* `Connections` are like "saved settings" for your adapters. What's the difference between
* a connection and an adapter, you might ask? An adapter (e.g. `sails-mysql`) is generic--
* it needs some additional information to work (e.g. your database host, password, user, etc.)
* A `connection` is that additional information.
*
* Each model must have a `connection` property (a string) which is references the name of one
* of these connections. If it doesn't, the default `connection` configured in `config/models.js`
* will be applied. Of course, a connection can (and usually is) shared by multiple models.
* .
* Note: If you're using version control, you should put your passwords/api keys
* in `config/local.js`, environment variables, or use another strategy.
* (this is to prevent you inadvertently sensitive credentials up to your repository.)
*
* For more information on configuration, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.connections.html
*/
module.exports.connections = {
/***************************************************************************
* *
* Local disk storage for DEVELOPMENT ONLY *
* *
* Installed by default. *
* *
***************************************************************************/
localDiskDb: {
adapter: 'sails-disk'
},
/***************************************************************************
* *
* MySQL is the world's most popular relational database. *
* http://en.wikipedia.org/wiki/MySQL *
* *
* Run: npm install sails-mysql *
* *
***************************************************************************/
mysqlDb: {
adapter: 'sails-mysql',
host: 'localhost',
user: 'website', //optional
password: 'henrypump', //optional
database: 'poconsole' //optional
},
/***************************************************************************
* *
* MongoDB is the leading NoSQL database. *
* http://en.wikipedia.org/wiki/MongoDB *
* *
* Run: npm install sails-mongo *
* *
***************************************************************************/
// someMongodbServer: {
// adapter: 'sails-mongo',
// host: 'localhost',
// port: 27017,
// user: 'username', //optional
// password: 'password', //optional
// database: 'your_mongo_db_name_here' //optional
// },
/***************************************************************************
* *
* PostgreSQL is another officially supported relational database. *
* http://en.wikipedia.org/wiki/PostgreSQL *
* *
* Run: npm install sails-postgresql *
* *
* *
***************************************************************************/
// somePostgresqlServer: {
// adapter: 'sails-postgresql',
// host: 'YOUR_POSTGRES_SERVER_HOSTNAME_OR_IP_ADDRESS',
// user: 'YOUR_POSTGRES_USER', // optional
// password: 'YOUR_POSTGRES_PASSWORD', // optional
// database: 'YOUR_POSTGRES_DB' //optional
// }
/***************************************************************************
* *
* More adapters: https://github.com/balderdashy/sails *
* *
***************************************************************************/
};

View File

@@ -0,0 +1,78 @@
/**
* Cross-Origin Resource Sharing (CORS) Settings
* (sails.config.cors)
*
* CORS is like a more modern version of JSONP-- it allows your server/API
* to successfully respond to requests from client-side JavaScript code
* running on some other domain (e.g. google.com)
* Unlike JSONP, it works with POST, PUT, and DELETE requests
*
* For more information on CORS, check out:
* http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
*
* Note that any of these settings (besides 'allRoutes') can be changed on a per-route basis
* by adding a "cors" object to the route configuration:
*
* '/get foo': {
* controller: 'foo',
* action: 'bar',
* cors: {
* origin: 'http://foobar.com,https://owlhoot.com'
* }
* }
*
* For more information on this configuration file, see:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.cors.html
*
*/
module.exports.cors = {
/***************************************************************************
* *
* Allow CORS on all routes by default? If not, you must enable CORS on a *
* per-route basis by either adding a "cors" configuration object to the *
* route config, or setting "cors:true" in the route config to use the *
* default settings below. *
* *
***************************************************************************/
// allRoutes: false,
/***************************************************************************
* *
* Which domains which are allowed CORS access? This can be a *
* comma-delimited list of hosts (beginning with http:// or https://) or *
* "*" to allow all domains CORS access. *
* *
***************************************************************************/
// origin: '*',
/***************************************************************************
* *
* Allow cookies to be shared for CORS requests? *
* *
***************************************************************************/
// credentials: true,
/***************************************************************************
* *
* Which methods should be allowed for CORS requests? This is only used in *
* response to preflight requests (see article linked above for more info) *
* *
***************************************************************************/
// methods: 'GET, POST, PUT, DELETE, OPTIONS, HEAD',
/***************************************************************************
* *
* Which headers should be allowed for CORS requests? This is only used in *
* response to preflight requests. *
* *
***************************************************************************/
// headers: 'content-type'
};

View File

@@ -0,0 +1,64 @@
/**
* Cross-Site Request Forgery Protection Settings
* (sails.config.csrf)
*
* CSRF tokens are like a tracking chip. While a session tells the server that a user
* "is who they say they are", a csrf token tells the server "you are where you say you are".
*
* When enabled, all non-GET requests to the Sails server must be accompanied by
* a special token, identified as the '_csrf' parameter.
*
* This option protects your Sails app against cross-site request forgery (or CSRF) attacks.
* A would-be attacker needs not only a user's session cookie, but also this timestamped,
* secret CSRF token, which is refreshed/granted when the user visits a URL on your app's domain.
*
* This allows us to have certainty that our users' requests haven't been hijacked,
* and that the requests they're making are intentional and legitimate.
*
* This token has a short-lived expiration timeline, and must be acquired by either:
*
* (a) For traditional view-driven web apps:
* Fetching it from one of your views, where it may be accessed as
* a local variable, e.g.:
* <form>
* <input type="hidden" name="_csrf" value="<%= _csrf %>" />
* </form>
*
* or (b) For AJAX/Socket-heavy and/or single-page apps:
* Sending a GET request to the `/csrfToken` route, where it will be returned
* as JSON, e.g.:
* { _csrf: 'ajg4JD(JGdajhLJALHDa' }
*
*
* Enabling this option requires managing the token in your front-end app.
* For traditional web apps, it's as easy as passing the data from a view into a form action.
* In AJAX/Socket-heavy apps, just send a GET request to the /csrfToken route to get a valid token.
*
* For more information on CSRF, check out:
* http://en.wikipedia.org/wiki/Cross-site_request_forgery
*
* For more information on this configuration file, including info on CSRF + CORS, see:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.csrf.html
*
*/
/****************************************************************************
* *
* Enabled CSRF protection for your site? *
* *
****************************************************************************/
// module.exports.csrf = false;
/****************************************************************************
* *
* You may also specify more fine-grained settings for CSRF, including the *
* domains which are allowed to request the CSRF token via AJAX. These *
* settings override the general CORS settings in your config/cors.js file. *
* *
****************************************************************************/
// module.exports.csrf = {
// grantTokenViaAjax: true,
// origin: ''
// }

24
tagserverApp/config/env/development.js vendored Normal file
View File

@@ -0,0 +1,24 @@
/**
* Development environment settings
*
* This file can include shared settings for a development team,
* such as API keys or remote database passwords. If you're using
* a version control solution for your Sails app, this file will
* be committed to your repository unless you add it to your .gitignore
* file. If your repository will be publicly viewable, don't add
* any private information to this file!
*
*/
module.exports = {
/***************************************************************************
* Set the default database connection for models in the development *
* environment (see config/connections.js and config/models.js ) *
***************************************************************************/
// models: {
// connection: 'someMongodbServer'
// }
};

38
tagserverApp/config/env/production.js vendored Normal file
View File

@@ -0,0 +1,38 @@
/**
* Production environment settings
*
* This file can include shared settings for a production environment,
* such as API keys or remote database passwords. If you're using
* a version control solution for your Sails app, this file will
* be committed to your repository unless you add it to your .gitignore
* file. If your repository will be publicly viewable, don't add
* any private information to this file!
*
*/
module.exports = {
/***************************************************************************
* Set the default database connection for models in the production *
* environment (see config/connections.js and config/models.js ) *
***************************************************************************/
// models: {
// connection: 'someMysqlServer'
// },
/***************************************************************************
* Set the port in the production environment to 80 *
***************************************************************************/
// port: 80,
/***************************************************************************
* Set the log level in production environment to "silent" *
***************************************************************************/
// log: {
// level: "silent"
// }
};

View File

@@ -0,0 +1,63 @@
/**
* Global Variable Configuration
* (sails.config.globals)
*
* Configure which global variables which will be exposed
* automatically by Sails.
*
* For more information on configuration, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.globals.html
*/
module.exports.globals = {
/****************************************************************************
* *
* Expose the lodash installed in Sails core as a global variable. If this *
* is disabled, like any other node module you can always run npm install *
* lodash --save, then var _ = require('lodash') at the top of any file. *
* *
****************************************************************************/
// _: true,
/****************************************************************************
* *
* Expose the async installed in Sails core as a global variable. If this is *
* disabled, like any other node module you can always run npm install async *
* --save, then var async = require('async') at the top of any file. *
* *
****************************************************************************/
// async: true,
/****************************************************************************
* *
* Expose the sails instance representing your app. If this is disabled, you *
* can still get access via req._sails. *
* *
****************************************************************************/
// sails: true,
/****************************************************************************
* *
* Expose each of your app's services as global variables (using their *
* "globalId"). E.g. a service defined in api/models/NaturalLanguage.js *
* would have a globalId of NaturalLanguage by default. If this is disabled, *
* you can still access your services via sails.services.* *
* *
****************************************************************************/
// services: true,
/****************************************************************************
* *
* Expose each of your app's models as global variables (using their *
* "globalId"). E.g. a model defined in api/models/User.js would have a *
* globalId of User by default. If this is disabled, you can still access *
* your models via sails.models.*. *
* *
****************************************************************************/
// models: true
};

View File

@@ -0,0 +1,93 @@
/**
* HTTP Server Settings
* (sails.config.http)
*
* Configuration for the underlying HTTP server in Sails.
* Only applies to HTTP requests (not WebSockets)
*
* For more information on configuration, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.http.html
*/
module.exports.http = {
/****************************************************************************
* *
* Express middleware to use for every Sails request. To add custom *
* middleware to the mix, add a function to the middleware config object and *
* add its key to the "order" array. The $custom key is reserved for *
* backwards-compatibility with Sails v0.9.x apps that use the *
* `customMiddleware` config option. *
* *
****************************************************************************/
middleware: {
/***************************************************************************
* *
* The order in which middleware should be run for HTTP request. (the Sails *
* router is invoked by the "router" middleware below.) *
* *
***************************************************************************/
// order: [
// 'startRequestTimer',
// 'cookieParser',
// 'session',
// 'myRequestLogger',
// 'bodyParser',
// 'handleBodyParserError',
// 'compress',
// 'methodOverride',
// 'poweredBy',
// '$custom',
// 'router',
// 'www',
// 'favicon',
// '404',
// '500'
// ],
/****************************************************************************
* *
* Example custom middleware; logs each request to the console. *
* *
****************************************************************************/
// myRequestLogger: function (req, res, next) {
// console.log("Requested :: ", req.method, req.url);
// return next();
// }
/***************************************************************************
* *
* The body parser that will handle incoming multipart HTTP requests. By *
* default as of v0.10, Sails uses *
* [skipper](http://github.com/balderdashy/skipper). See *
* http://www.senchalabs.org/connect/multipart.html for other options. *
* *
* Note that Sails uses an internal instance of Skipper by default; to *
* override it and specify more options, make sure to "npm install skipper" *
* in your project first. You can also specify a different body parser or *
* a custom function with req, res and next parameters (just like any other *
* middleware function). *
* *
***************************************************************************/
// bodyParser: require('skipper')({strict: true})
},
/***************************************************************************
* *
* The number of seconds to cache flat files on disk being served by *
* Express static middleware (by default, these files are in `.tmp/public`) *
* *
* The HTTP static cache is only active in a 'production' environment, *
* since that's the only time Express will cache flat-files. *
* *
***************************************************************************/
// cache: 31557600000
};

View File

@@ -0,0 +1,57 @@
/**
* Internationalization / Localization Settings
* (sails.config.i18n)
*
* If your app will touch people from all over the world, i18n (or internationalization)
* may be an important part of your international strategy.
*
*
* For more informationom i18n in Sails, check out:
* http://sailsjs.org/#!/documentation/concepts/Internationalization
*
* For a complete list of i18n options, see:
* https://github.com/mashpie/i18n-node#list-of-configuration-options
*
*
*/
module.exports.i18n = {
/***************************************************************************
* *
* Which locales are supported? *
* *
***************************************************************************/
// locales: ['en', 'es', 'fr', 'de'],
/****************************************************************************
* *
* What is the default locale for the site? Note that this setting will be *
* overridden for any request that sends an "Accept-Language" header (i.e. *
* most browsers), but it's still useful if you need to localize the *
* response for requests made by non-browser clients (e.g. cURL). *
* *
****************************************************************************/
// defaultLocale: 'en',
/****************************************************************************
* *
* Automatically add new keys to locale (translation) files when they are *
* encountered during a request? *
* *
****************************************************************************/
// updateFiles: false,
/****************************************************************************
* *
* Path (relative to app root) of directory to store locale (translation) *
* files in. *
* *
****************************************************************************/
// localesDirectory: '/config/locales'
};

View File

@@ -0,0 +1,28 @@
# Internationalization / Localization Settings
> Also see the official docs on internationalization/localization:
> http://links.sailsjs.org/docs/config/locales
## Locales
All locale files live under `config/locales`. Here is where you can add translations
as JSON key-value pairs. The name of the file should match the language that you are supporting, which allows for automatic language detection based on request headers.
Here is an example locale stringfile for the Spanish language (`config/locales/es.json`):
```json
{
"Hello!": "Hola!",
"Hello %s, how are you today?": "¿Hola %s, como estas?",
}
```
## Usage
Locales can be accessed in controllers/policies through `res.i18n()`, or in views through the `__(key)` or `i18n(key)` functions.
Remember that the keys are case sensitive and require exact key matches, e.g.
```ejs
<h1> <%= __('Welcome to PencilPals!') %> </h1>
<h2> <%= i18n('Hello %s, how are you today?', 'Pencil Maven') %> </h2>
<p> <%= i18n('That\'s right-- you can use either i18n() or __()') %> </p>
```
## Configuration
Localization/internationalization config can be found in `config/i18n.js`, from where you can set your supported locales.

View File

@@ -0,0 +1,4 @@
{
"Welcome": "Willkommen",
"A brand new app.": "Eine neue App."
}

View File

@@ -0,0 +1,4 @@
{
"Welcome": "Welcome",
"A brand new app.": "A brand new app."
}

View File

@@ -0,0 +1,4 @@
{
"Welcome": "Bienvenido",
"A brand new app.": "Una nueva aplicación."
}

View File

@@ -0,0 +1,4 @@
{
"Welcome": "Bienvenue",
"A brand new app.": "Une toute nouvelle application."
}

View File

@@ -0,0 +1,29 @@
/**
* Built-in Log Configuration
* (sails.config.log)
*
* Configure the log level for your app, as well as the transport
* (Underneath the covers, Sails uses Winston for logging, which
* allows for some pretty neat custom transports/adapters for log messages)
*
* For more information on the Sails logger, check out:
* http://sailsjs.org/#!/documentation/concepts/Logging
*/
module.exports.log = {
/***************************************************************************
* *
* Valid `level` configs: i.e. the minimum log level to capture with *
* sails.log.*() *
* *
* The order of precedence for log levels from lowest to highest is: *
* silly, verbose, info, debug, warn, error *
* *
* You may also set the level to "silent" to suppress all logs. *
* *
***************************************************************************/
// level: 'info'
};

View File

@@ -0,0 +1,32 @@
/**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#!/documentation/concepts/ORM
*/
module.exports.models = {
/***************************************************************************
* *
* Your app's default connection. i.e. the name of one of your app's *
* connections (see `config/connections.js`) *
* *
***************************************************************************/
// connection: 'localDiskDb',
/***************************************************************************
* *
* How and whether Sails will attempt to automatically rebuild the *
* tables/collections/etc. in your schema. *
* *
* See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html *
* *
***************************************************************************/
// migrate: 'alter'
};

View File

@@ -0,0 +1,51 @@
/**
* Policy Mappings
* (sails.config.policies)
*
* Policies are simple functions which run **before** your controllers.
* You can apply one or more policies to a given controller, or protect
* its actions individually.
*
* Any policy file (e.g. `api/policies/authenticated.js`) can be accessed
* below by its filename, minus the extension, (e.g. "authenticated")
*
* For more information on how policies work, see:
* http://sailsjs.org/#!/documentation/concepts/Policies
*
* For more information on configuring policies, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.policies.html
*/
module.exports.policies = {
/***************************************************************************
* *
* Default policy for all controllers and actions (`true` allows public *
* access) *
* *
***************************************************************************/
// '*': true,
/***************************************************************************
* *
* Here's an example of mapping some policies to run before a controller *
* and its actions *
* *
***************************************************************************/
// RabbitController: {
// Apply the `false` policy as the default for all of RabbitController's actions
// (`false` prevents all access, which ensures that nothing bad happens to our rabbits)
// '*': false,
// For the action `nurture`, apply the 'isRabbitMother' policy
// (this overrides `false` above)
// nurture : 'isRabbitMother',
// Apply the `isNiceToAnimals` AND `hasRabbitFood` policies
// before letting any users feed our rabbits
// feed : ['isNiceToAnimals', 'hasRabbitFood']
// }
};

View File

@@ -0,0 +1,49 @@
/**
* Route Mappings
* (sails.config.routes)
*
* Your routes map URLs to views and controllers.
*
* If Sails receives a URL that doesn't match any of the routes below,
* it will check for matching files (images, scripts, stylesheets, etc.)
* in your assets directory. e.g. `http://localhost:1337/images/foo.jpg`
* might match an image file: `/assets/images/foo.jpg`
*
* Finally, if those don't match either, the default 404 handler is triggered.
* See `api/responses/notFound.js` to adjust your app's 404 logic.
*
* Note: Sails doesn't ACTUALLY serve stuff from `assets`-- the default Gruntfile in Sails copies
* flat files from `assets` to `.tmp/public`. This allows you to do things like compile LESS or
* CoffeeScript for the front-end.
*
* For more information on configuring custom routes, check out:
* http://sailsjs.org/#!/documentation/concepts/Routes/RouteTargetSyntax.html
*/
module.exports.routes = {
/***************************************************************************
* *
* Make the view located at `views/homepage.ejs` (or `views/homepage.jade`, *
* etc. depending on your default view engine) your home page. *
* *
* (Alternatively, remove this and add an `index.html` file in your *
* `assets` directory) *
* *
***************************************************************************/
'/': {
view: 'homepage'
}
/***************************************************************************
* *
* Custom routes here... *
* *
* If a request to a URL doesn't match any of the custom routes above, it *
* is matched against Sails route blueprints. See `config/blueprints.js` *
* for configuration options and examples. *
* *
***************************************************************************/
};

View File

@@ -0,0 +1,100 @@
/**
* Session Configuration
* (sails.config.session)
*
* Sails session integration leans heavily on the great work already done by
* Express, but also unifies Socket.io with the Connect session store. It uses
* Connect's cookie parser to normalize configuration differences between Express
* and Socket.io and hooks into Sails' middleware interpreter to allow you to access
* and auto-save to `req.session` with Socket.io the same way you would with Express.
*
* For more information on configuring the session, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.session.html
*/
module.exports.session = {
/***************************************************************************
* *
* Session secret is automatically generated when your new app is created *
* Replace at your own risk in production-- you will invalidate the cookies *
* of your users, forcing them to log in again. *
* *
***************************************************************************/
secret: '04ff9bf2f018e56a4b644dbe316f3b4d',
/***************************************************************************
* *
* Set the session cookie expire time The maxAge is set by milliseconds, *
* the example below is for 24 hours *
* *
***************************************************************************/
// cookie: {
// maxAge: 24 * 60 * 60 * 1000
// },
/***************************************************************************
* *
* Uncomment the following lines to set up a Redis session store that can *
* be shared across multiple Sails.js servers. *
* *
* Requires connect-redis (https://www.npmjs.com/package/connect-redis) *
* *
***************************************************************************/
// adapter: 'redis',
/***************************************************************************
* *
* The following values are optional, if no options are set a redis *
* instance running on localhost is expected. Read more about options at: *
* *
* https://github.com/visionmedia/connect-redis *
* *
***************************************************************************/
// host: 'localhost',
// port: 6379,
// ttl: <redis session TTL in seconds>,
// db: 0,
// pass: <redis auth password>,
// prefix: 'sess:',
/***************************************************************************
* *
* Uncomment the following lines to set up a MongoDB session store that can *
* be shared across multiple Sails.js servers. *
* *
* Requires connect-mongo (https://www.npmjs.com/package/connect-mongo) *
* Use version 0.8.2 with Node version <= 0.12 *
* Use the latest version with Node >= 4.0 *
* *
***************************************************************************/
// adapter: 'mongo',
// url: 'mongodb://user:password@localhost:27017/dbname', // user, password and port optional
/***************************************************************************
* *
* Optional Values: *
* *
* See https://github.com/kcbanner/connect-mongo for more *
* information about connect-mongo options. *
* *
* See http://bit.ly/mongooptions for more information about options *
* available in `mongoOptions` *
* *
***************************************************************************/
// collection: 'sessions',
// stringify: true,
// mongoOptions: {
// server: {
// ssl: true
// }
// }
};

View File

@@ -0,0 +1,141 @@
/**
* WebSocket Server Settings
* (sails.config.sockets)
*
* These settings provide transparent access to the options for Sails'
* encapsulated WebSocket server, as well as some additional Sails-specific
* configuration layered on top.
*
* For more information on sockets configuration, including advanced config options, see:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.sockets.html
*/
module.exports.sockets = {
/***************************************************************************
* *
* Node.js (and consequently Sails.js) apps scale horizontally. It's a *
* powerful, efficient approach, but it involves a tiny bit of planning. At *
* scale, you'll want to be able to copy your app onto multiple Sails.js *
* servers and throw them behind a load balancer. *
* *
* One of the big challenges of scaling an application is that these sorts *
* of clustered deployments cannot share memory, since they are on *
* physically different machines. On top of that, there is no guarantee *
* that a user will "stick" with the same server between requests (whether *
* HTTP or sockets), since the load balancer will route each request to the *
* Sails server with the most available resources. However that means that *
* all room/pubsub/socket processing and shared memory has to be offloaded *
* to a shared, remote messaging queue (usually Redis) *
* *
* Luckily, Socket.io (and consequently Sails.js) apps support Redis for *
* sockets by default. To enable a remote redis pubsub server, uncomment *
* the config below. *
* *
* Worth mentioning is that, if `adapter` config is `redis`, but host/port *
* is left unset, Sails will try to connect to redis running on localhost *
* via port 6379 *
* *
***************************************************************************/
// adapter: 'memory',
//
// -OR-
//
// adapter: 'socket.io-redis',
// host: '127.0.0.1',
// port: 6379,
// db: 0,
// pass: '<redis auth password>',
/***************************************************************************
* *
* Whether to expose a 'get /__getcookie' route with CORS support that sets *
* a cookie (this is used by the sails.io.js socket client to get access to *
* a 3rd party cookie and to enable sessions). *
* *
* Warning: Currently in this scenario, CORS settings apply to interpreted *
* requests sent via a socket.io connection that used this cookie to *
* connect, even for non-browser clients! (e.g. iOS apps, toasters, node.js *
* unit tests) *
* *
***************************************************************************/
// grant3rdPartyCookie: true,
/***************************************************************************
* *
* `beforeConnect` *
* *
* This custom beforeConnect function will be run each time BEFORE a new *
* socket is allowed to connect, when the initial socket.io handshake is *
* performed with the server. *
* *
* By default, when a socket tries to connect, Sails allows it, every time. *
* (much in the same way any HTTP request is allowed to reach your routes. *
* If no valid cookie was sent, a temporary session will be created for the *
* connecting socket. *
* *
* If the cookie sent as part of the connection request doesn't match any *
* known user session, a new user session is created for it. *
* *
* In most cases, the user would already have a cookie since they loaded *
* the socket.io client and the initial HTML page you're building. *
* *
* However, in the case of cross-domain requests, it is possible to receive *
* a connection upgrade request WITHOUT A COOKIE (for certain transports) *
* In this case, there is no way to keep track of the requesting user *
* between requests, since there is no identifying information to link *
* him/her with a session. The sails.io.js client solves this by connecting *
* to a CORS/jsonp endpoint first to get a 3rd party cookie(fortunately this*
* works, even in Safari), then opening the connection. *
* *
* You can also pass along a ?cookie query parameter to the upgrade url, *
* which Sails will use in the absence of a proper cookie e.g. (when *
* connecting from the client): *
* io.sails.connect('http://localhost:1337?cookie=smokeybear') *
* *
* Finally note that the user's cookie is NOT (and will never be) accessible*
* from client-side javascript. Using HTTP-only cookies is crucial for your *
* app's security. *
* *
***************************************************************************/
// beforeConnect: function(handshake, cb) {
// // `true` allows the connection
// return cb(null, true);
//
// // (`false` would reject the connection)
// },
/***************************************************************************
* *
* `afterDisconnect` *
* *
* This custom afterDisconnect function will be run each time a socket *
* disconnects *
* *
***************************************************************************/
// afterDisconnect: function(session, socket, cb) {
// // By default: do nothing.
// return cb();
// },
/***************************************************************************
* *
* `transports` *
* *
* A array of allowed transport methods which the clients will try to use. *
* On server environments that don't support sticky sessions, the "polling" *
* transport should be disabled. *
* *
***************************************************************************/
// transports: ["polling", "websocket"]
};

View File

@@ -0,0 +1,95 @@
/**
* View Engine Configuration
* (sails.config.views)
*
* Server-sent views are a classic and effective way to get your app up
* and running. Views are normally served from controllers. Below, you can
* configure your templating language/framework of choice and configure
* Sails' layout support.
*
* For more information on views and layouts, check out:
* http://sailsjs.org/#!/documentation/concepts/Views
*/
module.exports.views = {
/****************************************************************************
* *
* View engine (aka template language) to use for your app's *server-side* *
* views *
* *
* Sails+Express supports all view engines which implement TJ Holowaychuk's *
* `consolidate.js`, including, but not limited to: *
* *
* ejs, jade, handlebars, mustache underscore, hogan, haml, haml-coffee, *
* dust atpl, eco, ect, jazz, jqtpl, JUST, liquor, QEJS, swig, templayed, *
* toffee, walrus, & whiskers *
* *
* For more options, check out the docs: *
* https://github.com/balderdashy/sails-wiki/blob/0.9/config.views.md#engine *
* *
****************************************************************************/
engine: 'ejs',
/****************************************************************************
* *
* Layouts are simply top-level HTML templates you can use as wrappers for *
* your server-side views. If you're using ejs or jade, you can take *
* advantage of Sails' built-in `layout` support. *
* *
* When using a layout, when one of your views is served, it is injected *
* into the `body` partial defined in the layout. This lets you reuse header *
* and footer logic between views. *
* *
* NOTE: Layout support is only implemented for the `ejs` view engine! *
* For most other engines, it is not necessary, since they implement *
* partials/layouts themselves. In those cases, this config will be *
* silently ignored. *
* *
* The `layout` setting may be set to one of the following: *
* *
* If `false`, layouts will be disabled. Otherwise, if a string is *
* specified, it will be interpreted as the relative path to your layout *
* file from `views/` folder. (the file extension, ".ejs", should be *
* omitted) *
* *
****************************************************************************/
/****************************************************************************
* *
* Using Multiple Layouts *
* *
* If you're using the default `ejs` or `handlebars` Sails supports the use *
* of multiple `layout` files. To take advantage of this, before rendering a *
* view, override the `layout` local in your controller by setting *
* `res.locals.layout`. (this is handy if you parts of your app's UI look *
* completely different from each other) *
* *
* e.g. your default might be *
* layout: 'layouts/public' *
* *
* But you might override that in some of your controllers with: *
* layout: 'layouts/internal' *
* *
****************************************************************************/
layout: 'layout',
/****************************************************************************
* *
* Partials are simply top-level snippets you can leverage to reuse template *
* for your server-side views. If you're using handlebars, you can take *
* advantage of Sails' built-in `partials` support. *
* *
* If `false` or empty partials will be located in the same folder as views. *
* Otherwise, if a string is specified, it will be interpreted as the *
* relative path to your partial files from `views/` folder. *
* *
****************************************************************************/
partials: false
};

37
tagserverApp/package.json Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "tagserverApp",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"ejs": "2.3.4",
"grunt": "0.4.5",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-coffee": "0.13.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-cssmin": "0.9.0",
"grunt-contrib-jst": "0.6.0",
"grunt-contrib-less": "1.1.0",
"grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.5.3",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.2.4",
"include-all": "~0.1.6",
"rc": "1.0.1",
"sails": "~0.12.3",
"sails-disk": "~0.10.9"
},
"scripts": {
"debug": "node debug app.js",
"start": "node app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/patrickjmcd/tagserverApp.git"
},
"author": "patrickjmcd",
"license": ""
}

View File

@@ -0,0 +1,54 @@
# About the `tasks` folder
The `tasks` directory is a suite of Grunt tasks and their configurations, bundled for your convenience. The Grunt integration is mainly useful for bundling front-end assets, (like stylesheets, scripts, & markup templates) but it can also be used to run all kinds of development tasks, from browserify compilation to database migrations.
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, read on!
### How does this work?
The asset pipeline bundled in Sails is a set of Grunt tasks configured with conventional defaults designed to make your project more consistent and productive.
The entire front-end asset workflow in Sails is completely customizable-- while it provides some suggestions out of the box, Sails makes no pretense that it can anticipate all of the needs you'll encounter building the browser-based/front-end portion of your application. Who's to say you're even building an app for a browser?
### What tasks does Sails run automatically?
Sails runs some of these tasks (the ones in the `tasks/register` folder) automatically when you run certain commands.
###### `sails lift`
Runs the `default` task (`tasks/register/default.js`).
###### `sails lift --prod`
Runs the `prod` task (`tasks/register/prod.js`).
###### `sails www`
Runs the `build` task (`tasks/register/build.js`).
###### `sails www --prod` (production)
Runs the `buildProd` task (`tasks/register/buildProd.js`).
### Can I customize this for SASS, Angular, client-side Jade templates, etc?
You can modify, omit, or replace any of these Grunt tasks to fit your requirements. You can also add your own Grunt tasks- just add a `someTask.js` file in the `grunt/config` directory to configure the new task, then register it with the appropriate parent task(s) (see files in `grunt/register/*.js`).
### Do I have to use Grunt?
Nope! To disable Grunt integration in Sails, just delete your Gruntfile or disable the Grunt hook.
### What if I'm not building a web frontend?
That's ok! A core tenant of Sails is client-agnosticism-- it's especially designed for building APIs used by all sorts of clients; native Android/iOS/Cordova, serverside SDKs, etc.
You can completely disable Grunt by following the instructions above.
If you still want to use Grunt for other purposes, but don't want any of the default web front-end stuff, just delete your project's `assets` folder and remove the front-end oriented tasks from the `grunt/register` and `grunt/config` folders. You can also run `sails new myCoolApi --no-frontend` to omit the `assets` folder and front-end-oriented Grunt tasks for future projects. You can also replace your `sails-generate-frontend` module with alternative community generators, or create your own. This allows `sails new` to create the boilerplate for native iOS apps, Android apps, Cordova apps, SteroidsJS apps, etc.

View File

@@ -0,0 +1,21 @@
/**
* `clean`
*
* ---------------------------------------------------------------
*
* Remove the files and folders in your Sails app's web root
* (conventionally a hidden directory called `.tmp/public`).
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-clean
*
*/
module.exports = function(grunt) {
grunt.config.set('clean', {
dev: ['.tmp/public/**'],
build: ['www']
});
grunt.loadNpmTasks('grunt-contrib-clean');
};

View File

@@ -0,0 +1,33 @@
/**
* `coffee`
*
* ---------------------------------------------------------------
*
* Compile CoffeeScript files located in `assets/js` into Javascript
* and generate new `.js` files in `.tmp/public/js`.
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-coffee
*
*/
module.exports = function(grunt) {
grunt.config.set('coffee', {
dev: {
options: {
bare: true,
sourceMap: true,
sourceRoot: './'
},
files: [{
expand: true,
cwd: 'assets/js/',
src: ['**/*.coffee'],
dest: '.tmp/public/js/',
ext: '.js'
}]
}
});
grunt.loadNpmTasks('grunt-contrib-coffee');
};

View File

@@ -0,0 +1,31 @@
/**
* `concat`
*
* ---------------------------------------------------------------
*
* Concatenates the contents of multiple JavaScript and/or CSS files
* into two new files, each located at `concat/production.js` and
* `concat/production.css` respectively in `.tmp/public/concat`.
*
* This is used as an intermediate step to generate monolithic files
* that can then be passed in to `uglify` and/or `cssmin` for minification.
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-concat
*
*/
module.exports = function(grunt) {
grunt.config.set('concat', {
js: {
src: require('../pipeline').jsFilesToInject,
dest: '.tmp/public/concat/production.js'
},
css: {
src: require('../pipeline').cssFilesToInject,
dest: '.tmp/public/concat/production.css'
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
};

View File

@@ -0,0 +1,44 @@
/**
* `copy`
*
* ---------------------------------------------------------------
*
* Copy files and/or folders from your `assets/` directory into
* the web root (`.tmp/public`) so they can be served via HTTP,
* and also for further pre-processing by other Grunt tasks.
*
* #### Normal usage (`sails lift`)
* Copies all directories and files (except CoffeeScript and LESS)
* from the `assets/` folder into the web root -- conventionally a
* hidden directory located `.tmp/public`.
*
* #### Via the `build` tasklist (`sails www`)
* Copies all directories and files from the .tmp/public directory into a www directory.
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-copy
*
*/
module.exports = function(grunt) {
grunt.config.set('copy', {
dev: {
files: [{
expand: true,
cwd: './assets',
src: ['**/*.!(coffee|less)'],
dest: '.tmp/public'
}]
},
build: {
files: [{
expand: true,
cwd: '.tmp/public',
src: ['**/*'],
dest: 'www'
}]
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
};

View File

@@ -0,0 +1,27 @@
/**
* Compress CSS files.
*
* ---------------------------------------------------------------
*
* Minify the intermediate concatenated CSS stylesheet which was
* prepared by the `concat` task at `.tmp/public/concat/production.css`.
*
* Together with the `concat` task, this is the final step that minifies
* all CSS files from `assets/styles/` (and potentially your LESS importer
* file from `assets/styles/importer.less`)
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-cssmin
*
*/
module.exports = function(grunt) {
grunt.config.set('cssmin', {
dist: {
src: ['.tmp/public/concat/production.css'],
dest: '.tmp/public/min/production.min.css'
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
};

View File

@@ -0,0 +1,48 @@
/**
* `jst`
*
* ---------------------------------------------------------------
*
* Precompile HTML templates using Underscore/Lodash notation into
* functions, creating a `.jst` file. This can be brought into your HTML
* via a <script> tag in order to expose your templates as `window.JST`
* for use in your client-side JavaScript.
*
* (i.e. in other words it takes HTML files in `assets/templates/` and
* turns them into tiny little javascript functions that return HTML strings
* when you pass a data dictionary into them. This approach is called
* "precompiling", and it can considerably speed up template rendering on
* the client, and even reduce bandwidth usage and related expenses.)
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-jst
*
*/
module.exports = function(grunt) {
grunt.config.set('jst', {
dev: {
// To use other sorts of templates, specify a regexp like the example below:
// options: {
// templateSettings: {
// interpolate: /\{\{(.+?)\}\}/g
// }
// },
// Note that the interpolate setting above is simply an example of overwriting lodash's
// default interpolation. If you want to parse templates with the default _.template behavior
// (i.e. using <div></div>), there's no need to overwrite `templateSettings.interpolate`.
files: {
// e.g.
// 'relative/path/from/gruntfile/to/compiled/template/destination' : ['relative/path/to/sourcefiles/**/*.html']
'.tmp/public/jst.js': require('../pipeline').templateFilesToInject
}
}
});
grunt.loadNpmTasks('grunt-contrib-jst');
};

View File

@@ -0,0 +1,31 @@
/**
* `less`
*
* ---------------------------------------------------------------
*
* Compile your LESS files into a CSS stylesheet.
*
* By default, only the `assets/styles/importer.less` is compiled.
* This allows you to control the ordering yourself, i.e. import your
* dependencies, mixins, variables, resets, etc. before other stylesheets)
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-less
*
*/
module.exports = function(grunt) {
grunt.config.set('less', {
dev: {
files: [{
expand: true,
cwd: 'assets/styles/',
src: ['importer.less'],
dest: '.tmp/public/styles/',
ext: '.css'
}]
}
});
grunt.loadNpmTasks('grunt-contrib-less');
};

View File

@@ -0,0 +1,283 @@
/**
* `sails-linker`
*
* ---------------------------------------------------------------
*
* Automatically inject <script> tags and <link> tags into the specified
* specified HTML and/or EJS files. The specified delimiters (`startTag`
* and `endTag`) determine the insertion points.
*
* #### Development (default)
* By default, tags will be injected for your app's client-side JavaScript files,
* CSS stylesheets, and precompiled client-side HTML templates in the `templates/`
* directory (see the `jst` task for more info on that). In addition, if a LESS
* stylesheet exists at `assets/styles/importer.less`, it will be compiled to CSS
* and a `<link>` tag will be inserted for it. Similarly, if any Coffeescript
* files exists in `assets/js/`, they will be compiled into JavaScript and injected
* as well.
*
* #### Production (`NODE_ENV=production`)
* In production, all stylesheets are minified into a single `.css` file (see
* `tasks/config/cssmin.js` task) and all client-side scripts are minified into
* a single `.js` file (see `tasks/config/uglify.js` task). Any client-side HTML
* templates, CoffeeScript, or LESS files are bundled into these same two minified
* files as well.
*
* For usage docs see:
* https://github.com/Zolmeister/grunt-sails-linker
*
*/
module.exports = function(grunt) {
grunt.config.set('sails-linker', {
devJs: {
options: {
startTag: '<!--SCRIPTS-->',
endTag: '<!--SCRIPTS END-->',
fileTmpl: '<script src="%s"></script>',
appRoot: '.tmp/public'
},
files: {
'.tmp/public/**/*.html': require('../pipeline').jsFilesToInject,
'views/**/*.html': require('../pipeline').jsFilesToInject,
'views/**/*.ejs': require('../pipeline').jsFilesToInject
}
},
devJsRelative: {
options: {
startTag: '<!--SCRIPTS-->',
endTag: '<!--SCRIPTS END-->',
fileTmpl: '<script src="%s"></script>',
appRoot: '.tmp/public',
relative: true
},
files: {
'.tmp/public/**/*.html': require('../pipeline').jsFilesToInject,
'views/**/*.html': require('../pipeline').jsFilesToInject,
'views/**/*.ejs': require('../pipeline').jsFilesToInject
}
},
prodJs: {
options: {
startTag: '<!--SCRIPTS-->',
endTag: '<!--SCRIPTS END-->',
fileTmpl: '<script src="%s"></script>',
appRoot: '.tmp/public'
},
files: {
'.tmp/public/**/*.html': ['.tmp/public/min/production.min.js'],
'views/**/*.html': ['.tmp/public/min/production.min.js'],
'views/**/*.ejs': ['.tmp/public/min/production.min.js']
}
},
prodJsRelative: {
options: {
startTag: '<!--SCRIPTS-->',
endTag: '<!--SCRIPTS END-->',
fileTmpl: '<script src="%s"></script>',
appRoot: '.tmp/public',
relative: true
},
files: {
'.tmp/public/**/*.html': ['.tmp/public/min/production.min.js'],
'views/**/*.html': ['.tmp/public/min/production.min.js'],
'views/**/*.ejs': ['.tmp/public/min/production.min.js']
}
},
devStyles: {
options: {
startTag: '<!--STYLES-->',
endTag: '<!--STYLES END-->',
fileTmpl: '<link rel="stylesheet" href="%s">',
appRoot: '.tmp/public'
},
files: {
'.tmp/public/**/*.html': require('../pipeline').cssFilesToInject,
'views/**/*.html': require('../pipeline').cssFilesToInject,
'views/**/*.ejs': require('../pipeline').cssFilesToInject
}
},
devStylesRelative: {
options: {
startTag: '<!--STYLES-->',
endTag: '<!--STYLES END-->',
fileTmpl: '<link rel="stylesheet" href="%s">',
appRoot: '.tmp/public',
relative: true
},
files: {
'.tmp/public/**/*.html': require('../pipeline').cssFilesToInject,
'views/**/*.html': require('../pipeline').cssFilesToInject,
'views/**/*.ejs': require('../pipeline').cssFilesToInject
}
},
prodStyles: {
options: {
startTag: '<!--STYLES-->',
endTag: '<!--STYLES END-->',
fileTmpl: '<link rel="stylesheet" href="%s">',
appRoot: '.tmp/public'
},
files: {
'.tmp/public/index.html': ['.tmp/public/min/production.min.css'],
'views/**/*.html': ['.tmp/public/min/production.min.css'],
'views/**/*.ejs': ['.tmp/public/min/production.min.css']
}
},
prodStylesRelative: {
options: {
startTag: '<!--STYLES-->',
endTag: '<!--STYLES END-->',
fileTmpl: '<link rel="stylesheet" href="%s">',
appRoot: '.tmp/public',
relative: true
},
files: {
'.tmp/public/index.html': ['.tmp/public/min/production.min.css'],
'views/**/*.html': ['.tmp/public/min/production.min.css'],
'views/**/*.ejs': ['.tmp/public/min/production.min.css']
}
},
// Bring in JST template object
devTpl: {
options: {
startTag: '<!--TEMPLATES-->',
endTag: '<!--TEMPLATES END-->',
fileTmpl: '<script type="text/javascript" src="%s"></script>',
appRoot: '.tmp/public'
},
files: {
'.tmp/public/index.html': ['.tmp/public/jst.js'],
'views/**/*.html': ['.tmp/public/jst.js'],
'views/**/*.ejs': ['.tmp/public/jst.js']
}
},
devJsJade: {
options: {
startTag: '// SCRIPTS',
endTag: '// SCRIPTS END',
fileTmpl: 'script(src="%s")',
appRoot: '.tmp/public'
},
files: {
'views/**/*.jade': require('../pipeline').jsFilesToInject
}
},
devJsRelativeJade: {
options: {
startTag: '// SCRIPTS',
endTag: '// SCRIPTS END',
fileTmpl: 'script(src="%s")',
appRoot: '.tmp/public',
relative: true
},
files: {
'views/**/*.jade': require('../pipeline').jsFilesToInject
}
},
prodJsJade: {
options: {
startTag: '// SCRIPTS',
endTag: '// SCRIPTS END',
fileTmpl: 'script(src="%s")',
appRoot: '.tmp/public'
},
files: {
'views/**/*.jade': ['.tmp/public/min/production.min.js']
}
},
prodJsRelativeJade: {
options: {
startTag: '// SCRIPTS',
endTag: '// SCRIPTS END',
fileTmpl: 'script(src="%s")',
appRoot: '.tmp/public',
relative: true
},
files: {
'views/**/*.jade': ['.tmp/public/min/production.min.js']
}
},
devStylesJade: {
options: {
startTag: '// STYLES',
endTag: '// STYLES END',
fileTmpl: 'link(rel="stylesheet", href="%s")',
appRoot: '.tmp/public'
},
files: {
'views/**/*.jade': require('../pipeline').cssFilesToInject
}
},
devStylesRelativeJade: {
options: {
startTag: '// STYLES',
endTag: '// STYLES END',
fileTmpl: 'link(rel="stylesheet", href="%s")',
appRoot: '.tmp/public',
relative: true
},
files: {
'views/**/*.jade': require('../pipeline').cssFilesToInject
}
},
prodStylesJade: {
options: {
startTag: '// STYLES',
endTag: '// STYLES END',
fileTmpl: 'link(rel="stylesheet", href="%s")',
appRoot: '.tmp/public'
},
files: {
'views/**/*.jade': ['.tmp/public/min/production.min.css']
}
},
prodStylesRelativeJade: {
options: {
startTag: '// STYLES',
endTag: '// STYLES END',
fileTmpl: 'link(rel="stylesheet", href="%s")',
appRoot: '.tmp/public',
relative: true
},
files: {
'views/**/*.jade': ['.tmp/public/min/production.min.css']
}
},
// Bring in JST template object
devTplJade: {
options: {
startTag: '// TEMPLATES',
endTag: '// TEMPLATES END',
fileTmpl: 'script(type="text/javascript", src="%s")',
appRoot: '.tmp/public'
},
files: {
'views/**/*.jade': ['.tmp/public/jst.js']
}
}
});
grunt.loadNpmTasks('grunt-sails-linker');
};

View File

@@ -0,0 +1,31 @@
/**
* `sync`
*
* ---------------------------------------------------------------
*
* Synchronize files from the `assets` folder to `.tmp/public`,
* smashing anything that's already there.
*
* This task synchronizes one directory with another (like rsync).
* In the default Sails asset pipeline, it plays very similar role
* to `grunt-contrib-copy`, but copies only those files that have
* actually changed since the last time the task was run.
*
* For usage docs see:
* https://github.com/tomusdrw/grunt-sync
*
*/
module.exports = function(grunt) {
grunt.config.set('sync', {
dev: {
files: [{
cwd: './assets',
src: ['**/*.!(coffee|less)'],
dest: '.tmp/public'
}]
}
});
grunt.loadNpmTasks('grunt-sync');
};

View File

@@ -0,0 +1,22 @@
/**
* `uglify`
*
* ---------------------------------------------------------------
*
* Minify client-side JavaScript files using UglifyJS.
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-uglify
*
*/
module.exports = function(grunt) {
grunt.config.set('uglify', {
dist: {
src: ['.tmp/public/concat/production.js'],
dest: '.tmp/public/min/production.min.js'
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
};

View File

@@ -0,0 +1,31 @@
/**
* `watch`
*
* ---------------------------------------------------------------
*
* Run predefined tasks whenever watched file patterns are added, changed or deleted.
*
* Watch for changes on:
* - files in the `assets` folder
* - the `tasks/pipeline.js` file
* and re-run the appropriate tasks.
*
* For usage docs see:
* https://github.com/gruntjs/grunt-contrib-watch
*
*/
module.exports = function(grunt) {
grunt.config.set('watch', {
assets: {
// Assets to watch:
files: ['assets/**/*', 'tasks/pipeline.js', '!**/node_modules/**'],
// When assets are changed:
tasks: ['syncAssets' , 'linkAssets' ]
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
};

View File

@@ -0,0 +1,75 @@
/**
* grunt/pipeline.js
*
* The order in which your css, javascript, and template files should be
* compiled and linked from your views and static HTML files.
*
* (Note that you can take advantage of Grunt-style wildcard/glob/splat expressions
* for matching multiple files.)
*
* For more information see:
* https://github.com/balderdashy/sails-docs/blob/master/anatomy/myApp/tasks/pipeline.js.md
*/
// CSS files to inject in order
//
// (if you're using LESS with the built-in default config, you'll want
// to change `assets/styles/importer.less` instead.)
var cssFilesToInject = [
'styles/**/*.css'
];
// Client-side javascript files to inject in order
// (uses Grunt-style wildcard/glob/splat expressions)
var jsFilesToInject = [
// Load sails.io before everything else
'js/dependencies/sails.io.js',
// Dependencies like jQuery, or Angular are brought in here
'js/dependencies/**/*.js',
// All of the rest of your client-side js files
// will be injected here in no particular order.
'js/**/*.js'
];
// Client-side HTML templates are injected using the sources below
// The ordering of these templates shouldn't matter.
// (uses Grunt-style wildcard/glob/splat expressions)
//
// By default, Sails uses JST templates and precompiles them into
// functions for you. If you want to use jade, handlebars, dust, etc.,
// with the linker, no problem-- you'll just want to make sure the precompiled
// templates get spit out to the same file. Be sure and check out `tasks/README.md`
// for information on customizing and installing new tasks.
var templateFilesToInject = [
'templates/**/*.html'
];
// Default path for public folder (see documentation for more information)
var tmpPath = '.tmp/public/';
// Prefix relative paths to source files so they point to the proper locations
// (i.e. where the other Grunt tasks spit them out, or in some cases, where
// they reside in the first place)
module.exports.cssFilesToInject = cssFilesToInject.map(function(cssPath) {
return require('path').join('.tmp/public/', cssPath);
});
module.exports.jsFilesToInject = jsFilesToInject.map(function(jsPath) {
return require('path').join('.tmp/public/', jsPath);
});
module.exports.templateFilesToInject = templateFilesToInject.map(function(tplPath) {
return require('path').join('assets/',tplPath);
});

View File

@@ -0,0 +1,27 @@
/**
* `build`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist will be executed if you run `sails www` or
* `grunt build` in a development environment. It generates a
* folder containing your compiled assets, e.g. for troubleshooting
* issues with other Grunt plugins, bundling assets for an Electron
* or PhoneGap app, or deploying your app's flat files to a CDN.
*
* Note that when running `sails www` in a production environment (with the
* `NODE_ENV` environment variable set to 'production') the `buildProd` task
* will be run instead of this one.
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/build-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('build', [
'compileAssets',
'linkAssetsBuild',
'clean:build',
'copy:build'
]);
};

View File

@@ -0,0 +1,29 @@
/**
* `buildProd`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist will be executed instead of `build` if you
* run `sails www` in a production environment, e.g.:
* `NODE_ENV=production sails www`
*
* This generates a folder containing your compiled (and usually minified)
* assets. The most common use case for this is bundling up files to
* deploy to a CDN.
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/build-prod-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('buildProd', [
'compileAssets',
'concat',
'uglify',
'cssmin',
'linkAssetsBuildProd',
'clean:build',
'copy:build'
]);
};

View File

@@ -0,0 +1,22 @@
/**
* `compileAssets`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist is not designed to be used directly-- rather
* it is a helper called by the `default`, `prod`, `build`, and
* `buildProd` tasklists.
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/compile-assets-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('compileAssets', [
'clean:dev',
'jst:dev',
'less:dev',
'copy:dev',
'coffee:dev'
]);
};

View File

@@ -0,0 +1,21 @@
/**
* `default`
*
* ---------------------------------------------------------------
*
* This is the default Grunt tasklist that will be executed if you
* run `grunt` in the top level directory of your app. It is also
* called automatically when you start Sails in development mode using
* `sails lift` or `node app`.
*
* Note that when lifting your app in a production environment (with the
* `NODE_ENV` environment variable set to 'production') the `prod` task
* will be run instead of this one.
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/default-js
*
*/
module.exports = function (grunt) {
grunt.registerTask('default', ['compileAssets', 'linkAssets', 'watch']);
};

View File

@@ -0,0 +1,23 @@
/**
* `linkAssets`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist is not designed to be used directly-- rather
* it is a helper called by the `default` tasklist and the `watch` task
* (but only if the `grunt-sails-linker` package is in use).
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/link-assets-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('linkAssets', [
'sails-linker:devJs',
'sails-linker:devStyles',
'sails-linker:devTpl',
'sails-linker:devJsJade',
'sails-linker:devStylesJade',
'sails-linker:devTplJade'
]);
};

View File

@@ -0,0 +1,22 @@
/**
* `linkAssetsBuild`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist is not designed to be used directly-- rather
* it is a helper called by the `build` tasklist.
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/link-assets-build-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('linkAssetsBuild', [
'sails-linker:devJsRelative',
'sails-linker:devStylesRelative',
'sails-linker:devTpl',
'sails-linker:devJsRelativeJade',
'sails-linker:devStylesRelativeJade',
'sails-linker:devTplJade'
]);
};

View File

@@ -0,0 +1,22 @@
/**
* `linkAssetsBuildProd`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist is not designed to be used directly-- rather
* it is a helper called by the `buildProd` tasklist.
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/link-assets-build-prod-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('linkAssetsBuildProd', [
'sails-linker:prodJsRelative',
'sails-linker:prodStylesRelative',
'sails-linker:devTpl',
'sails-linker:prodJsRelativeJade',
'sails-linker:prodStylesRelativeJade',
'sails-linker:devTplJade'
]);
};

View File

@@ -0,0 +1,27 @@
/**
* `prod`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist will be executed instead of `default` when
* your Sails app is lifted in a production environment (e.g. using
* `NODE_ENV=production node app`).
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/prod-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('prod', [
'compileAssets',
'concat',
'uglify',
'cssmin',
'sails-linker:prodJs',
'sails-linker:prodStyles',
'sails-linker:devTpl',
'sails-linker:prodJsJade',
'sails-linker:prodStylesJade',
'sails-linker:devTplJade'
]);
};

View File

@@ -0,0 +1,20 @@
/**
* `syncAssets`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist is not designed to be used directly-- rather
* it is a helper called by the `watch` task (`tasks/config/watch.js`).
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/sync-assets-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('syncAssets', [
'jst:dev',
'less:dev',
'sync:dev',
'coffee:dev'
]);
};

View File

@@ -0,0 +1,68 @@
<!--
444444444 000000000 333333333333333
4::::::::4 00:::::::::00 3:::::::::::::::33
4:::::::::4 00:::::::::::::00 3::::::33333::::::3
4::::44::::4 0:::::::000:::::::03333333 3:::::3
4::::4 4::::4 0::::::0 0::::::0 3:::::3
4::::4 4::::4 0:::::0 0:::::0 3:::::3
4::::4 4::::4 0:::::0 0:::::0 33333333:::::3
4::::444444::::4440:::::0 000 0:::::0 3:::::::::::3
4::::::::::::::::40:::::0 000 0:::::0 33333333:::::3
4444444444:::::4440:::::0 0:::::0 3:::::3
4::::4 0:::::0 0:::::0 3:::::3
4::::4 0::::::0 0::::::0 3:::::3
4::::4 0:::::::000:::::::03333333 3:::::3
44::::::44 00:::::::::::::00 3::::::33333::::::3
4::::::::4 00:::::::::00 3:::::::::::::::33
4444444444 000000000 333333333333333
This is the default "403: Forbidden" page.
User agents that don't "Accept" HTML will see a JSON version instead.
You can customize the control logic for your needs in `config/403.js`
You can trigger this response from one of your controllers or policies with:
`return res.forbidden( msg );`
(where `msg` is an optional error message to include in the response)
-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600' rel='stylesheet' type='text/css'>
<style>
/* Styles included inline since you'll probably be deleting or replacing this page anyway */
html,body{text-align:left;font-size:1em}html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0}ul,li{list-style:none}img{display:block}a img{border:0}a{text-decoration:none;font-weight:normal;font-family:inherit}*:active,*:focus{outline:0;-moz-outline-style:none}h1,h2,h3,h4,h5,h6,h7{font-weight:normal;font-size:1em}.clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden}.page .ocean{background:url('http://sailsjs.com/images/waves.png') #0c8da0 no-repeat center 282px;height:315px}.page .ocean img{margin-right:auto;margin-left:auto}.page .waves{display:block;padding-top:25px;margin-right:auto;margin-left:auto}.page .main{display:block;margin-top:90px}.page .logo{width:150px;margin-top:3.5em;margin-left:auto;margin-right:auto}.page .fishy{display:block;padding-top:100px}.page .help{padding-top:2em}.page h1{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-weight:bold;font-size:1.7em;color:#001c20;text-align:center}.page h2{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-weight:300;font-size:1.5em;color:#001c20;text-align:center}.page p{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-size:1.25em;color:#001c20;text-align:center}.page a{color:#118798}.page a:hover{color:#b1eef7}
</style>
<div class="page">
<div class="ocean">
<img class="fishy" src="http://sailsjs.com/images/image_devInTub.png">
</div>
<div class="main">
<h1>
Forbidden
</h1>
<h2>
<% if (typeof data !== 'undefined') { %>
<%= data %>
<% } else { %>
You don't have permission to see the page you're trying to reach.
<% } %>
</h2>
<p class="help">
<a href="http://en.wikipedia.org/wiki/HTTP_403">Why</a> might this be happening?
</p>
</div>
<div class="logo">
<a href="http://sailsjs.org">
<img src="http://sailsjs.org/images/logo.png">
</a>
</div>
</div>

View File

@@ -0,0 +1,68 @@
<!--
444444444 000000000 444444444
4::::::::4 00:::::::::00 4::::::::4
4:::::::::4 00:::::::::::::00 4:::::::::4
4::::44::::4 0:::::::000:::::::0 4::::44::::4
4::::4 4::::4 0::::::0 0::::::0 4::::4 4::::4
4::::4 4::::4 0:::::0 0:::::0 4::::4 4::::4
4::::4 4::::4 0:::::0 0:::::0 4::::4 4::::4
4::::444444::::4440:::::0 000 0:::::04::::444444::::444
4::::::::::::::::40:::::0 000 0:::::04::::::::::::::::4
4444444444:::::4440:::::0 0:::::04444444444:::::444
4::::4 0:::::0 0:::::0 4::::4
4::::4 0::::::0 0::::::0 4::::4
4::::4 0:::::::000:::::::0 4::::4
44::::::44 00:::::::::::::00 44::::::44
4::::::::4 00:::::::::00 4::::::::4
4444444444 000000000 4444444444
This is the default "404: Not Found" page.
User agents that don't "Accept" HTML will see a JSON version instead.
You can customize the control logic for your needs in `config/404.js`
Sails considers a request to be in a "404: Not Found" state when a user
requests a URL which doesn't match any of your app's routes or blueprints.
You can also trigger this response from one of your controllers or policies with:
`return res.notFound();`
-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600' rel='stylesheet' type='text/css'>
<style>
/* Styles included inline since you'll probably be deleting this page anyway */
html,body{text-align:left;font-size:1em}html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0}ul,li{list-style:none}img{display:block}a img{border:0}a{text-decoration:none;font-weight:normal;font-family:inherit}*:active,*:focus{outline:0;-moz-outline-style:none}h1,h2,h3,h4,h5,h6,h7{font-weight:normal;font-size:1em}.clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden}.fourohfour .ocean{background:url('http://sailsjs.com/images/waves.png') #0c8da0 no-repeat center 282px;height:315px}.fourohfour .ocean img{margin-right:auto;margin-left:auto}.fourohfour .waves{display:block;padding-top:25px;margin-right:auto;margin-left:auto}.fourohfour .main{display:block;margin-top:90px}.fourohfour .logo{width:150px;margin-top:3.5em;margin-left:auto;margin-right:auto}.fourohfour .fishy{display:block;padding-top:27px}.fourohfour .help{padding-top:2em}.fourohfour h1{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-weight:bold;font-size:1.7em;color:#001c20;text-align:center}.fourohfour h2{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-weight:300;font-size:1.5em;color:#001c20;text-align:center}.fourohfour p{font-family:"Open Sans","Myriad Pro",Arial,sans-serif;font-size:1.25em;color:#001c20;text-align:center}.fourohfour a{color:#118798}.fourohfour a:hover{color:#b1eef7}
</style>
<div class="fourohfour">
<div class="ocean">
<img class="fishy" src="http://sailsjs.org/images/fishy4.png">
</div>
<div class="main">
<h1>
Something's fishy here.
</h1>
<h2>
<% if (typeof data!== 'undefined') { %>
<%= data %>
<% } else { %>
The page you were trying to reach doesn't exist.
<% } %>
</h2>
<p class="help">
<a href="http://en.wikipedia.org/wiki/HTTP_404">Why</a> might this be happening?
</p>
</div>
<div class="logo">
<a href="http://sailsjs.org">
<img src="http://sailsjs.org/images/logo.png">
</a>
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
<!-- Default home page -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600' rel='stylesheet' type='text/css'>
<style>
/* Styles included inline since you'll probably be deleting this page anyway */
html,body{text-align:left;font-size:1em}html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0}ul,li{list-style:none}img{display:block}a img{border:0}a{text-decoration:none;font-weight:normal;font-family:inherit}*:active,*:focus{outline:0;-moz-outline-style:none}h1,h2,h3,h4,h5,h6{font-weight:normal}div.clear{clear:both}.clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden}body{font-family:"Open Sans",Arial,sans-serif;font-weight:300;}.top-bar {width: 100%; background-color: #e4f0f1; padding: 15px 0;}.top-bar .container img {float: left;}.top-bar .container ul {float: right; padding-top: 25px;}.top-bar .container li {float: left; width: 125px; text-align: center; font-size: 15px; color:#000; font-weight: 600;}.top-bar .container a li:hover {color: #118798; -webkit-transition:color 200ms; -moz-transition:color 200ms; -o-transition:color 200ms;transition:color 200ms;}.container{width: 80%; max-width: 1200px; margin: auto;}div.header {-webkit-transition: 6s; -moz-transition: 6s; -o-transition: 6s;transition: 6s; background: rgba(4, 36, 41, 0.89) url(http://sailsjs.org/images/img_sailsShadow.png) no-repeat 42% bottom; padding: 100px 0 65px;}.header h1#main-title{color: #fff; font-weight: 300; font-size: 2.5em;}.header h3{color: #b1eef7; font-style: italic; font-weight: 300;}.header h3 code{font-style: normal!important; background-color: rgba(255,255,255,0.5); font-weight: 300; color:#0e6471; margin: 0px 5px;}div.main.container{padding: 50px 0;}h1 {color: #118798; font-weight: 300;}code {font-size: inherit; font-family: 'Consolas', 'Monaco', monospace; padding:4px 5px 1px; background-color: #f3f5f7}a{color: #118798; font-weight: 300; text-decoration: underline;}a:hover {color: #0e6471; -webkit-transition:color 200ms; -moz-transition:color 200ms; -o-transition:color 200ms;transition:color 200ms;}p{line-height: 1.5em;}blockquote{background-color: #e4f0f1; padding: 25px; line-height: 1.5em; margin: 15px 0;}blockquote span{font-weight: 600; padding-right: 5px;}ul.getting-started{padding: 25px 75px 25px 0; width: 70%; float: left; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;}ul.getting-started li{padding: 25px 0;}ul.getting-started li h3 {padding-bottom: 10px; font-size: 25px; font-weight: 300;}.sprite{background:url(http://sailsjs.org/images/newapp.sprite.png) no-repeat; position: absolute; left: 0; top:0;}.getting-started .sprite{margin-left:10px;padding-left:60px;height:42px;width:0; float: left;}.getting-started .one{background-position:0 0}.getting-started .two{background-position:0 -42px}.getting-started .three{background-position:0 -83px}div.step {position: relative; padding-left: 70px; opacity: 0.9;}div.step:hover{ opacity: 1;}div.links {float: left; width: 30%; max-width: 325px; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; background-color: #f3f5f7; border: 1px solid #ebebeb; padding: 25px 45px 35px;}div.links h3 {color: #727272; text-align: center; font-size: 28px; font-weight: 300;}div.links h4 {color: #727272; font-size: 17px; font-weight: 600; padding: 15px 0 10px;}div.links .link-list a {text-decoration: none; font-weight: 400;}div.links .link-list a li {padding: 0px 0px 5px 10px;}div.default-page{min-width: 1200px;}.pocket{display:none;}
</style>
<script type="text/javascript">
setTimeout(function sunrise () {
document.getElementsByClassName('header')[0].style.backgroundColor = '#118798';
}, 0);
</script>
<div class="default-page">
<div class="header">
<h1 id="main-title" class="container"><%= __('A brand new app.') %></h1>
<h3 class="container">You're looking at: <code><%= view.pathFromApp + '.' +view.ext %></code></h3>
</div>
<div class="main container clearfix">
<!-- <h1>Getting started</h1>
<p>Don't worry, we've got your back.</p> -->
<ul class="getting-started">
<li class="clearfix">
<div class="step">
<div class="sprite one"></div>
<h3>Generate a REST API.</h3>
<p>
Run <code>sails generate api user</code>. This will create two files: a <a href="http://sailsjs.org/#!/documentation/concepts/ORM/Models.html">model</a> <code class="pocket">api/models/User.js</code> and a <a href="http://sailsjs.org/#!/documentation/concepts/Controllers">controller</a><code class="pocket">api/controllers/UserController.js</code>.
</p>
</div>
</li>
<li class="clearfix">
<div class="step">
<div class="sprite two"></div>
<h3>
Lift your app.
</h3>
<p>
Run <code>sails lift</code> to start up your app server. If you visit <a target="_blank" href="http://localhost:<%= sails.config.port || 1337%>/user"><code>http://localhost:<%= sails.config.port || 1337%>/user</code></a> in your browser, you'll see a <a href="http://sailsjs.org/#!/documentation/reference/blueprint-api">WebSocket-compatible</a> user API.
</p>
</div>
</li>
<li class="clearfix">
<div class="step">
<div class="sprite three"></div>
<h3>
Dive in.
</h3>
<p>Blueprints are just the beginning. You'll probably also want to learn how to customize your app's <a href="http://sailsjs.org/#!/documentation/concepts/Routes">routes</a>, set up <a href="http://sailsjs.org/#!/documentation/concepts/Policies">security policies</a>, configure your <a href="http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.connections.html">data sources</a>, and build custom <a target="_blank" href="http://sailsjs.org/#!/documentation/concepts/Controllers?q=actions">controller actions</a>. For more help getting started, check out the links on this page.</p>
</div>
</li>
</ul>
<div class="links">
<!-- <h3>Links</h3> -->
<ul class="link-list">
<h4>Docs</h4>
<a target="_blank" href="http://sailsjs.org/#!/documentation/anatomy/myApp"><li>App Structure</li></a>
<a target="_blank" href="http://sailsjs.org/#!/documentation/reference"><li>Reference</li></a>
<a target="_blank" href="http://sailsjs.org/#!/documentation/concepts/extending-sails/Adapters/adapterList.html"><li>Supported Databases</li></a>
<h4>Tutorials</h4>
<a target="_blank" href="https://github.com/sails101"><li>Sails 101</li></a>
<h4>Community</h4>
<a target="_blank" href="http://stackoverflow.com/search?q=sails.js"><li>StackOverFlow</li></a>
<a target="_blank" href="https://github.com/balderdashy/sails"><li>GitHub</li></a>
<a target="_blank" href="https://groups.google.com/forum/#!forum/sailsjs"><li>Google Group</li></a>
<a target="_blank" href="http://webchat.freenode.net/"><li>IRC (#sailsjs on freenode)</li></a>
</ul>
</div>
</div>
</div>

View File

@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html>
<head>
<title><%=typeof title == 'undefined' ? 'New Sails App' : title%></title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--
Stylesheets and Preprocessors
==============================
You can always bring in CSS files manually with `<link>` tags, or asynchronously
using a solution like AMD (RequireJS). Or, if you like, you can take advantage
of Sails' conventional asset pipeline (boilerplate Gruntfile).
By default, stylesheets from your `assets/styles` folder are included
here automatically (between STYLES and STYLES END). Both CSS (.css) and LESS (.less)
are supported. In production, your styles will be minified and concatenated into
a single file.
To customize any part of the built-in behavior, just edit `tasks/pipeline.js`.
For example, here are a few things you could do:
+ Change the order of your CSS files
+ Import stylesheets from other directories
+ Use a different or additional preprocessor, like SASS, SCSS or Stylus
-->
<!--STYLES-->
<link rel="stylesheet" href="/styles/importer.css">
<!--STYLES END-->
</head>
<body>
<%- body %>
<!--
Client-side Templates
========================
HTML templates are important prerequisites of modern, rich client applications.
To work their magic, frameworks like Backbone, Angular, Ember, and Knockout require
that you load these templates client-side.
By default, your Gruntfile is configured to automatically load and precompile
client-side JST templates in your `assets/templates` folder, then
include them here automatically (between TEMPLATES and TEMPLATES END).
To customize this behavior to fit your needs, just edit `tasks/pipeline.js`.
For example, here are a few things you could do:
+ Import templates from other directories
+ Use a different template engine (handlebars, jade, dust, etc.)
+ Internationalize your client-side templates using a server-side
stringfile before they're served.
-->
<!--TEMPLATES-->
<!--TEMPLATES END-->
<!--
Client-side Javascript
========================
You can always bring in JS files manually with `script` tags, or asynchronously
on the client using a solution like AMD (RequireJS). Or, if you like, you can
take advantage of Sails' conventional asset pipeline (boilerplate Gruntfile).
By default, files in your `assets/js` folder are included here
automatically (between SCRIPTS and SCRIPTS END). Both JavaScript (.js) and
CoffeeScript (.coffee) are supported. In production, your scripts will be minified
and concatenated into a single file.
To customize any part of the built-in behavior, just edit `tasks/pipeline.js`.
For example, here are a few things you could do:
+ Change the order of your scripts
+ Import scripts from other directories
+ Use a different preprocessor, like TypeScript
-->
<!--SCRIPTS-->
<script src="/js/dependencies/sails.io.js"></script>
<!--SCRIPTS END-->
</body>
</html>

View File

@@ -4,12 +4,16 @@ CREATE TABLE IF NOT EXISTS tag_classes(
id INT NOT NULL AUTO_INCREMENT,
tag_class varchar(64),
description varchar(64),
createdAt DATETIME,
updatedAt DATETIME,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS device_types(
id INT NOT NULL AUTO_INCREMENT,
dType VARCHAR(64),
createdAt DATETIME,
updatedAt DATETIME,
PRIMARY KEY (id)
);
@@ -18,6 +22,8 @@ CREATE TABLE IF NOT EXISTS devices(
name varchar(64),
device_type INT,
address VARCHAR(64),
createdAt DATETIME,
updatedAt DATETIME,
PRIMARY KEY (id),
INDEX device_type_ind (device_type),
FOREIGN KEY (device_type)
@@ -38,7 +44,8 @@ CREATE TABLE IF NOT EXISTS tags(
units varchar(64),
minExpected varchar(64),
maxExpected varchar(64),
deleted INT NULL DEFAULT 0,
createdAt DATETIME,
updatedAt DATETIME,
PRIMARY KEY (id),
INDEX class_ind (class),
FOREIGN KEY (class)
@@ -53,9 +60,10 @@ CREATE TABLE IF NOT EXISTS tags(
CREATE TABLE IF NOT EXISTS tag_vals(
id INT NOT NULL AUTO_INCREMENT,
dtime datetime,
tagID int,
val float,
createdAt DATETIME,
updatedAt DATETIME,
PRIMARY KEY (id),
INDEX tagID_ind (tagID),
FOREIGN KEY (tagID)
@@ -67,7 +75,8 @@ CREATE TABLE IF NOT EXISTS config (
id INT NOT NULL AUTO_INCREMENT,
parameter varchar(128),
val varchar(128),
dateAdded TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
createdAt DATETIME,
updatedAt DATETIME,
PRIMARY KEY (id)
);