I am using Sails for a project. I used Chrome POSTMAN to create a model instance. After that, I can not start sails server. The error message is attached below.
I realized that this is due to association I have in the model. How can I use POSTMAN to correctly create User instance?
api/model/User.js
:
module.exports = {
connection: 'localDiskDb',
attributes: {
firstName: {
type: 'string',
required: true,
minLength: 1,
string: true,
alphadashed: true
},
lastName: {
type: 'string',
required: true,
minLength: 2,
string: true,
alphadashed: true
},
cars: {
collection: 'car',
via: 'owner'
}
}
Error message when lifting sails:
/usr/local/lib/node_modules/sails/node_modules/waterline/lib/
waterline/core/typecast.js:56
Object.keys(values).forEach(function(key) {
^
TypeError: Object.keys called on non-object
at Function.keys (native)
at Cast.run (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/core/typecast.js:56:10)
at /usr/local/lib/node_modules/sails/node_modules/sails-disk/lib/database.js:209:46
at Array.map (native)
at Database.read (/usr/local/lib/node_modules/sails/node_modules/sails-disk/lib/database.js:208:32)
at Array.async.auto.checkData [as 0] (/usr/local/lib/node_modules/sails/node_modules/sails-disk/lib/database.js:59:12)
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:459:38
at Array.forEach (native)
at _each (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:32:24)
at Object.async.auto (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:430:9)