Now I had the building blocks for dojoexpress! Let's explore the project structure.

shared - This folder is accessible to both server and client side code. Think of validation logic shared between client and sever - pretty cool stuff!

frontend - This folder is only accessible to HTML clients (e.g. browser). Think of it as your WebContent folder in a traditional web app

backend - This folder is accessible only on the server. Think of it as your backend.

js-lib - Add other js packages here. For example, dijit, dojox etc. The dojo package in found under node_modules. This folder is accessible to client and server.

app.js - bootstraps the app. This file sets up the dojo/node environment and starts an Express server with socket.io support on port 3434

One thing that a backend needs is the ability to host RESTful services. In a previous life I worked a lot with Java EE servers.
I assume that many of you have also come from that not so distant past, and are familiar with Apache Wink. If not, no biggy.
All you need to know is that you define RESTful resources like so (see backend/rest/Message.js):

The above should look familiar if you work with Express. "backend/global" contains a pointer to the express server in "global.app".
See backend/server.js, where you have access to socket.io and the node sever itself:

global.app = app;

global.server = server;

global.io = io;

The above code is cool, because you are able to split up your RESTful services (e.g. Express paths) into AMD modules. Think about it, you can easily create a streaming socket.io version of
any of your services as well through the use of global.io.

Finally, like Apache Wink, you need to register your resources to be loaded on server startup. To do this, you add the path to
backend/rest/Resources.js. For example:

require([

"backend/rest/Message",

"backend/rest/User"

]);

So by now you probably want to fire things up for a test spin. To do this: