Skip to content

Commit 362c252

Browse files
committed
Update: README, bump version to 2.3.9
1 parent 14a2e4a commit 362c252

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,37 @@ app.use(moesifExpress(options));
5151
### 2. Enter Moesif Application Id.
5252
You can find your Application Id from [_Moesif Dashboard_](https://www.moesif.com/) -> _Top Right Menu_ -> _App Setup_
5353

54+
## Not using Express?
55+
If you're not using the express framework, you can still use this library.
56+
The library does not depend on express, so you can still call the middleware from a basic HTTP server.
57+
58+
```javascript
59+
var moesifExpress = require('moesif-express');
60+
const http = require('http');
61+
62+
var options = {
63+
applicationId: 'Your Application Id'
64+
};
65+
66+
var server = http.createServer(function (req, res) {
67+
moesifExpress(options)(req, res, function () {
68+
// Callback
69+
});
70+
71+
req.on('end', function () {
72+
73+
res.write(JSON.stringify({
74+
message: "hello world!",
75+
id: 2
76+
}));
77+
res.end();
78+
});
79+
});
80+
81+
server.listen(8080);
82+
83+
```
84+
5485
## Configuration options
5586

5687

@@ -245,8 +276,8 @@ moesifMiddleware.updateUser(user, callback);
245276

246277
```
247278

248-
The metadata field can be any custom data you want to set on the user.
249-
The userId field is required.
279+
The metadata field can be any custom data you want to set on the user.
280+
The userId field is required.
250281

251282

252283
## Other integrations

lib/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ module.exports = function (options) {
118118
logEvent(resBodyBuf, req, res, options, moesifController);
119119
};
120120

121-
next();
121+
if (next) {
122+
next();
123+
}
122124
};
123125

124126
moesifMiddleware.updateUser = function (userModel, cb) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "moesif-express",
3-
"version": "2.3.8",
3+
"version": "2.3.9",
44
"description": "Collection/Data Ingestion Middleware for Express",
55
"main": "./lib/index.js",
66
"keywords": [

0 commit comments

Comments
 (0)