
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
dojo-express
Advanced tools
A Node.js Express based server with Socket.io support. It is based on dojo/node.
A Node.js Express based server with Socket.io support. It is based on dojo/node, and supports RESTful services.
OK so I was looking for a way to write client and server side code in the same language. With Node.js and Express, I was able to write client and server side Javascript - step 1 check.
One thing was still bothering me though. I love the AMD style package structure that Dojo has implemented on the client, and I wanted to write the same code on the server side. Amazingly I found the following https://dojotoolkit.org/reference-guide/1.9/dojo/node.html - step 2 check.
Now I had the building blocks for dojoexpress! Let's explore the project structure.
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):
require(["dojo/_base/declare","backend/global"],function(declare,global){
var path = "/rest/message";
var app = global.app;
app.get(path,function(req,resp){
resp.json({name : "chris",last: "Felix"});
});
app.get(path + "/:id",function(req,resp){
resp.json({name : "chris",last: "Felix",id: req.params.id});
});
});
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:
{
"name": "chris",
"last": "Felix"
}
Well that's about it. Happy hacking!
This project is distributed by the Dojo Foundation and licensed under the "New" BSD License. All contributions require a Dojo Foundation CLA.
FAQs
A Node.js Express based server with Socket.io support. It is based on dojo/node.
The npm package dojo-express receives a total of 4 weekly downloads. As such, dojo-express popularity was classified as not popular.
We found that dojo-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.