Note that there are some explanatory texts on larger screens.

plurals
  1. PONot Seeing Id In Sails JS Response
    primarykey
    data
    text
    <p>So I'm messing around with SailsJS to try to get an API up and running real fast. I haven't setup a data store yet (will probably use mongodb) but I saw that there is what I'm assuming is like a SQLite database or something. So I generated a model and controller for a User. So in the browser I hit user/create. I see createdAt and updatedAt but no Id. Do I need a real datastore to see an ID? Is this still something you get for free? </p> <p>Adapter</p> <pre><code>// Configure installed adapters // If you define an attribute in your model definition, // it will override anything from this global config. module.exports.adapters = { // If you leave the adapter config unspecified // in a model definition, 'default' will be used. 'default': 'disk', // In-memory adapter for DEVELOPMENT ONLY // (data is NOT preserved when the server shuts down) memory: { module: 'sails-dirty', inMemory: true }, // Persistent adapter for DEVELOPMENT ONLY // (data IS preserved when the server shuts down) // PLEASE NOTE: disk adapter not compatible with node v0.10.0 currently // because of limitations in node-dirty // See https://github.com/felixge/node-dirty/issues/34 disk: { module: 'sails-dirty', filePath: './.tmp/dirty.db', inMemory: false }, // MySQL is the world's most popular relational database. // Learn more: http://en.wikipedia.org/wiki/MySQL mysql: { module : 'sails-mysql', host : 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS', user : 'YOUR_MYSQL_USER', password : 'YOUR_MYSQL_PASSWORD', database : 'YOUR_MYSQL_DB' } }; </code></pre> <p>Model</p> <pre><code>/*--------------------- :: User -&gt; model ---------------------*/ module.exports = { attributes: { firstName: 'STRING', lastName: 'STRING' } }; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload