Permalink
Browse files

Improve example to be more easy to run

  • Loading branch information...
1 parent cb81a89 commit 506a0c712a9b130bee4b56148a60e68304726c74 @maritz committed Aug 28, 2013
@@ -1,3 +1,9 @@
Simple example of a basic REST api using nohm. This is in no way secure and has no authentication checks.
-It requires express
+Use
+
+ npm install
+
+in this directory to install the dependencies and then run it with
+
+ node rest-server.js
@@ -1,7 +1,7 @@
$(function () {
var updateUserList = function () {
$.get('/User/list', function (response) {
- $ul = $('#users');
+ var $ul = $('#users');
$ul.empty();
$.each(response, function (index, item) {
$ul.append('<li>'+JSON.stringify(item)+'</li>');
@@ -10,10 +10,10 @@ $(function () {
}
updateUserList();
$('#refreshusers').click(updateUserList);
-
+
$('form').submit(function (e) {
e.preventDefault();
-
+
var data = {};
$('input').each(function () {
var $this = $(this);
@@ -0,0 +1,23 @@
+{
+ "name": "nohm-example-usage",
+ "version": "0.1.0",
+ "engines": {
+ "node" : ">=0.10"
+ },
+ "author": "Moritz Peters",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/maritz/nohm.git"
+ },
+ "bugs" : {
+ "url" : "https://github.com/maritz/nohm/issues"
+ },
+ "directories": {
+ "lib": "./lib"
+ },
+ "description": "small nohm example app",
+ "dependencies": {
+ "nohm": "0.9",
+ "express": "3.0"
+ }
+}

0 comments on commit 506a0c7

Please sign in to comment.