New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autoroute-express-promise

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autoroute-express-promise - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

7

index.js

@@ -5,8 +5,9 @@ /// <reference path="typings/typings.d.ts" />

var toControllers = _.curry(function (_a, controllerMethod) {
var message = _a.message, baseRoute = _a.baseRoute, sendWrapper = _a.sendWrapper, routeName = _a.routeName;
var message = _a.message, baseRoute = _a.baseRoute, response = _a.response, routeName = _a.routeName;
var routeMethodIndex = controllerMethod[0], baseController = controllerMethod[1], methodName = autoroute_base_1.method[routeMethodIndex], messageInfo = { routeName: routeName, methodName: methodName };
// Wrap base controller in express style callback.
baseRoute[methodName](function (request, client, error) {
message.call(messageInfo, messageInfo);
var send = _.compose(client.send.bind(client), sendWrapper);
if (message)
message.call(messageInfo, messageInfo);
var send = _.partial(response, client);
baseController(request).then(send).catch(error).done();

@@ -13,0 +14,0 @@ });

{
"name": "autoroute-express-promise",
"version": "0.0.1",
"version": "0.1.0",
"description": "autoroute for use with promises",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,3 +17,3 @@ # Auto-route Express Promise

- Stable/Release
- Beta
- Active (June 26, 2015)

@@ -37,3 +37,3 @@

baseRoute: authenticatedRoute,
sendWrapper: withMessageAs,
response: (response, result) => response.send(withMessageAs(result)),
message: (o) => {console.log(o.routeName, o.methodName)}

@@ -142,3 +142,3 @@ }, ['./controllers/**/index.js'])

message?: (options: {routeName: string; methodName: string}) => void
sendWrapper?: (result: any) => any
response: (client: Express.Response, result: any) => any
}

@@ -164,11 +164,9 @@ ```

**sendWrapper**: (Optional) Used to wrap the result in some wrapper, e.g.,
**response**: (Required) Used to wrap the result in some wrapper and send
method, e.g.,
```js
result => {result: result}
(client, result) => client.send({result: result})
```
So, when sending with `Express.js` `response.send(sendWrapper(result))` will
respond with `{result: result}`.
where `glob`:

@@ -191,2 +189,2 @@

method[0] // => "get"
```
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc