How to access information in Sails after creation?

63 views Asked by At

I was wondering what happens in Sails when you pass information in through the URL. For example, if you were to type:

localhost:1337/project/create?Id=2&Name=John

how does Sails create that into a model? I need to be able to take the name and pass it to separate database, but I have no idea how to access the information (such as name=John, in this case) after each creation.

Thanks, I appreciate it!

1

There are 1 answers

0
jaumard On BEST ANSWER

Under your api/models/project.js file you can override afterCreate method like doc say :

afterCreate: fn(newlyInsertedRecord, cb)

More here : http://sailsjs.org/#!/documentation/concepts/ORM/Lifecyclecallbacks.html