Comparing version 1.5.3 to 1.5.4
@@ -12,3 +12,3 @@ # Helpers | ||
```javascript | ||
var greeting = await sails.helpers.formatWelcomeMessage('Bubba'); | ||
const greeting = await sails.helpers.formatWelcomeMessage('Bubba'); | ||
sails.log(greeting); | ||
@@ -48,3 +48,3 @@ // => "Hello, Bubba!" | ||
fn: async function (inputs, exits) { | ||
var result = `Hello, ${inputs.name}!`; | ||
const result = `Hello, ${inputs.name}!`; | ||
return exits.success(result); | ||
@@ -82,3 +82,3 @@ } | ||
```javascript | ||
var greeting = await sails.helpers.formatWelcomeMessage.with({ name: 'Bubba' }); | ||
const greeting = await sails.helpers.formatWelcomeMessage.with({ name: 'Bubba' }); | ||
``` | ||
@@ -102,3 +102,3 @@ | ||
```javascript | ||
var newUserId = sails.helpers.inviteNewUser('bubba@hawtmail.com') | ||
const newUserId = sails.helpers.inviteNewUser('bubba@hawtmail.com') | ||
.intercept('emailAddressInUse', 'badRequest'); | ||
@@ -148,3 +148,3 @@ ``` | ||
```javascript | ||
var headers = await sails.helpers.parseMyHeaders(req); | ||
const headers = await sails.helpers.parseMyHeaders(req); | ||
``` | ||
@@ -167,3 +167,3 @@ | ||
```javascript | ||
var result = await sails.helpers.formatWelcomeMessage('Dolly'); | ||
const result = await sails.helpers.formatWelcomeMessage('Dolly'); | ||
sails.log('Ok it worked! The result is:', result); | ||
@@ -179,3 +179,3 @@ ``` | ||
```javascript | ||
var greeting = sails.helpers.formatWelcomeMessage('Timothy'); | ||
const greeting = sails.helpers.formatWelcomeMessage('Timothy'); | ||
``` | ||
@@ -185,3 +185,20 @@ | ||
##### Organizing helpers | ||
If your application uses many helpers, you might find it helpful to group related helpers into subdirectories. For example, imagine you had a number of `user` helpers and several `item` helpers, organized in the following directory structure | ||
``` | ||
api/ | ||
helpers/ | ||
user/ | ||
find-by-username.js | ||
toggle-admin-role.js | ||
validate-username.js | ||
item/ | ||
set-price.js | ||
apply-coupon.js | ||
``` | ||
When calling these helpers, each subfolder name (e.g. `user` and `item`) becomes an additional property layer in the `sails.helpers` object, so you can call `find-by-username.js` using `sails.helpers.user.findByUsername()` and you can call `set-price.js` with `sails.helpers.item.setPrice()`. | ||
> For more information, you can read a [conversation between Ryan Emberling and Mike McNeil](https://www.linkedin.com/feed/update/urn:li:activity:6998946887701565440?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A6998946887701565440%2C7000154787505668096%29) which goes into more detail about this use case, including some general tips and tricks for working with custom helpers and organics. | ||
### Handling exceptions | ||
@@ -188,0 +205,0 @@ |
@@ -299,2 +299,4 @@ # Attributes | ||
> When using `unique: true` on an attribute with the `utf8mb4` character set in a MySQL database, you will need to set the column size manually via the [`columnType` property](https://sailsjs.com/documentation/concepts/models-and-orm/attributes#?columntype) to avoid a possible 'index too long' error. For example: `columnType: varchar(100) CHARACTER SET utf8mb4`. | ||
<!-- | ||
@@ -301,0 +303,0 @@ |
@@ -22,2 +22,4 @@ # `.update()` | ||
> **Note**: For performance reasons, as of Sails v1.0 / Waterline 0.13, the `valuesToSet` object passed into this model method will be mutated in-place in most situations (whereas in Sails/Waterline v0.12, this was not necessarily the case). | ||
##### Result | ||
@@ -24,0 +26,0 @@ |
@@ -20,2 +20,4 @@ # `.updateOne()` | ||
> **Note**: For performance reasons, as of Sails v1.0 / Waterline 0.13, the `valuesToSet` object passed into this model method will be mutated in-place in most situations (whereas in Sails/Waterline v0.12, this was not necessarily the case). | ||
##### Result | ||
@@ -22,0 +24,0 @@ |
@@ -7,3 +7,3 @@ # Full-stack JavaScript with Sails | ||
#### Links | ||
+ [Take the course](https://courses.platzi.com/classes/sails-js/) | ||
+ [Take the course](https://platzi.com/cursos/sails-js/) | ||
+ [Try out the demo app (Ration)](https://ration.io) | ||
@@ -10,0 +10,0 @@ + [Download the source code](https://github.com/mikermcneil/ration) for the demo app |
{ | ||
"name": "sails", | ||
"author": "Mike McNeil <@mikermcneil>", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "API-driven framework for building realtime apps, using MVC conventions (based on Express and Socket.io)", | ||
@@ -40,3 +40,3 @@ "license": "MIT", | ||
"ejs": "3.1.7", | ||
"express": "4.17.1", | ||
"express": "4.17.3", | ||
"express-session": "1.17.0", | ||
@@ -43,0 +43,0 @@ "flaverr": "^1.10.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3258087
+ Addedbody-parser@1.19.2(transitive)
+ Addedcontent-disposition@0.5.4(transitive)
+ Addedcookie@0.4.2(transitive)
+ Addedexpress@4.17.3(transitive)
+ Addedhttp-errors@1.8.1(transitive)
+ Addedqs@6.9.7(transitive)
+ Addedraw-body@2.4.3(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsend@0.17.2(transitive)
+ Addedserve-static@1.14.2(transitive)
- Removedbody-parser@1.19.0(transitive)
- Removedbytes@3.1.0(transitive)
- Removedcontent-disposition@0.5.3(transitive)
- Removedexpress@4.17.1(transitive)
- Removedhttp-errors@1.7.2(transitive)
- Removedms@2.1.1(transitive)
- Removedqs@6.7.0(transitive)
- Removedraw-body@2.4.0(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsend@0.17.1(transitive)
- Removedserve-static@1.14.1(transitive)
Updatedexpress@4.17.3