Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

micro

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro - npm Package Compare versions

Comparing version 7.2.1 to 7.2.2

7

lib/server.js

@@ -25,3 +25,3 @@ // Native

.then(val => {
if (val === null || val === undefined) {
if (val === null) {
send(res, 204, null)

@@ -31,3 +31,6 @@ return

send(res, res.statusCode || 200, val)
// Return a undefined-null value -> send
if (undefined !== val) {
send(res, res.statusCode || 200, val)
}
})

@@ -34,0 +37,0 @@ .catch(err => sendError(req, res, err))

{
"name": "micro",
"version": "7.2.1",
"version": "7.2.2",
"description": "Asynchronous HTTP microservices",

@@ -49,3 +49,3 @@ "main": "./lib/server.js",

"coveralls": "2.12.0",
"husky": "0.13.3-0",
"husky": "0.13.3",
"nyc": "10.1.2",

@@ -52,0 +52,0 @@ "request": "2.81.0",

@@ -40,8 +40,14 @@ ![](https://raw.githubusercontent.com/zeit/art/31913be3107827adf10e1f491ec61480f63e19af/micro/logo.png)

After that, we have to create an `index.js` file and populate it:
Then create an `index.js` file and populate it with function, that accepts standard [http.IncomingMessage](https://nodejs.org/api/http.html#http_class_http_incomingmessage) and [http.ServerResponse](https://nodejs.org/api/http.html#http_class_http_serverresponse) objects:
```js
module.exports = (req, res) => 'Welcome to micro'
module.exports = (req, res) => res.end('Welcome to micro')
```
Micro provides [useful helpers](https://github.com/zeit/micro#body-parsing) but also handles return values – so you can write it even shorter!
```js
module.exports = () => 'Welcome to micro'
```
Once all of that is done, just start the server:

@@ -48,0 +54,0 @@

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