Your first Deployd API #

If you haven't already, install Deployd.

You can create a new project by running the following commands in your terminal/command prompt (using terminal on mac / cmd on windows).

dpd create hello-world
cd hello-world
dpd -d

This will create your API, run Deployd, and open up your dashboard.

Dashboard

Create a new collection by selecting it from the Resource + dropdown. In the "Create New Collection" prompt, enter /things.

Give your 'things' collection a property of name and press enter. Note - Most screens in the dashboard have keyboard shortcuts.

Add some data to the collection by opening up the data editor. Click the "Data" menu item under "Things". With the data editor open and the new row selected, you can just start typing a name. Type "foo", then hit enter, "bat", enter, "baz", enter.

Now you should have a data editor that looks like this.

Dashboard

Click the "API" menu item to see documentation for accessing your collection. If you open up http://localhost:2403/things in a browser, you should see the following JSON:

Dashboard

Open up http://localhost:2403 in your browser and pull up your console. Try the following:

dpd.things.get(console.log);
dpd.things.get({$limit: 1}, console.log);
dpd.things.get({name: 'foo'}, console.log);

You should see something like the following:

Dashboard

More Tutorials and Examples #

Debugging #

Deployd uses debug to log requests and show other internal debug info. Check how to use it under The "dpd" Command Line Tool, and Creating a Module.

More