Question: I am trying to make a simple adding calculator on node.js and express.js that can add only two number but when I use the number function of JS that convert strings to a number so I got the error is:

```
RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 4
    at ServerResponse.writeHead (_http_server.js:242:11)
    at ServerResponse._implicitHeader (_http_server.js:233:8)
    at ServerResponse.end (_http_outgoing.js:692:10)
    at ServerResponse.send 

```

My CODE IS :

```
const express = require("express");
const bodyParser = require("body-parser");

const app = express();
app.use(bodyParser.urlencoded({extended: true}));
app.get("/", function(req, res){
    res.sendFile(__dirname + "/index.html");
});
app.post("/", function(req, res){
    var a = Number(req.body.num1);
    var b = Number(req.body.num2);
    var result = a + b;
    res.send(result);
})
app.listen("3000", function(){
    console.log("The App is on port 3000")
})

```

So what should I do?

Answer: 
With a broadcast Receiver:

```
@Override public void onReceive(Context context, Intent intent) {
    if (ACTION_SHUTDOWN.equals(intent.getAction()) || QUICKBOOT_POWEROFF.equals(intent.getAction())) {
        // Do something..
    }
}

```

Apply an intent filter to your manifest declared broadcast receiver to listen to two actions:

```
<action android:name="android.intent.action.ACTION_SHUTDOWN"/>
<action android:name="android.intent.action.QUICKBOOT_POWEROFF"/>

```
Trigger your c service in initrc:

1. trigger by property: 

on property:sys.shutdown.requested=\*  

stop cnss-daemon
2. trigger by [shutdown critical](https://android.googlesource.com/platform/system/core/+/refs/heads/master/init/README.md)

> 
> `shutdown <shutdown_behavior>`
>  Set shutdown behavior of the service process. When this is not specified,
>  the service is killed during shutdown process by using SIGTERM and SIGKILL.
>  The service with shutdown\_behavior of "critical" is not killed during shutdown
>  until shutdown times out. When shutdown times out, even services tagged with
>  "shutdown critical" will be killed. When the service tagged with "shutdown critical"
>  is not running when shut down starts, it will be started.
> 
> 
>