Commits

Magnus Hoff  committed 7995e8c

Added example-directory

  • Participants
  • Parent commits 74016ba

Comments (0)

Files changed (2)

 
  * I want to read a simple example: [example-fileresource.js][1]
  * I want to serve a file directly from disk: [example-fileresource.js][1]
+ * I want to serve a directory directly from disk: [example-directory.js][4]
  * I want to create a simple custom resource: [example-custom-resource.js][2]
  * I want to implement CRUD: [example-crud.js][3]
 
 [1]: https://bitbucket.org/maghoff/resource-tree/src/tip/example-fileresource.js
 [2]: https://bitbucket.org/maghoff/resource-tree/src/tip/example-custom-resource.js
 [3]: https://bitbucket.org/maghoff/resource-tree/src/tip/example-crud.js
+[4]: https://bitbucket.org/maghoff/resource-tree/src/tip/example-directory.js

File example-directory.js

+#!/usr/bin/env node
+
+var resource_tree = require("./resource-tree");
+
+resource_tree.createServer(new resource_tree.FileLookup(".")).listen(8080);
+
+console.log("Now you can GET everything in the current directory under http://127.0.0.1:8080/\n");
+
+console.log("For example:");
+console.log("  * http://127.0.0.1:8080/example-directory.js");
+console.log("  * http://127.0.0.1:8080/README.md");