December 2018
Intermediate to advanced
642 pages
15h 5m
English
We've set everything up; now, let's see our code working:
> npm run build> node out/middleware.js
We can use some curl requests to test this; let's use GET, POST, and DELETE:
> curl "http://127.0.0.1:8080/some/path/to/get?value=9" Server alive, with Express!> curl -X POST "http://127.0.0.1:8080/a/post/to/a/path" Server alive, with Express!> curl -X DELETE "http://127.0.0.1:8080/try/to/delete?key=22" INTERNAL SERVER ERROR
The logged output will be as follows:
Logger... 2018-05-08T00:22:20.192Z GET /some/path/to/getLogger... 2018-05-08T00:22:44.282Z POST /a/post/to/a/pathLogger... 2018-05-08T00:23:01.888Z DELETE /try/to/deleteError.... DELETEs are not accepted!
Now, we now know how to write our own middleware, but it so happens ...
Read now
Unlock full access