sailsCasts

Learning about sails.js one screencast at a time.

Creating a Restful Json Api in Less Than 15 Seconds Using sails.js

| Comments

In a very short amount of time I was able to create a powerful api that I can use to immediately feed my front-in application.

The Transcript

Howdy,

I’m going to create a restful json api in less than 15 seconds using sails.js

Here’s a timer to keep me honest Ready, go Okay that was quick, but what do I get for all my hard work? First I’ll start the sails server to see what I’ve created. You may of noticed I generated both a user controller and user model When I look at the user list there’s no users, but I can quickly change that by adding users right here in the browser First I’ll create user with the name attribute of John Galt Next, the user Aimmee Man My personal hero Nikola Tesla and finally Thomas Edison.

But wait, I’ve mispelled Aimme Mann’s last name….no worries I can update it from here…. Also I’ve included Nikola Tesla’s arch enemy Thomas Edison I’m not a big fan of old Tom so I’ll destroy him from our list

In a very short amount of time I’ve created a powerful api that I can use to immediately feed my front in application.

By the way if you’re concerned with the convience functionality of creating, deleting, and updating users from the browser you can easily turn it off.

just go into your the controllers config file and set the short-cuts to false.

Now when I try to create a user I get a 404.

To learn more about sails go to their website at sailsjs.com and be sure to check back to this website where I’ll be posting screencasts on how to use other parts of sails.

Thanks for watching.

Comments