I am learning how to use custom middlewares properly by following this example here
I placed the datetime.js
file in my server/middleware
folder and try to use it in my server.js (according to the documentation on Middlware here):
var datetime = require('datetime');
app.middleware('initial:before', datetime());
However, when I try to start the app by 'slc run
', I got complaint that
Error: Cannot find module 'datetime'
So I suspect if the server can even detect the middleware 'datetime'. What is the right way of using custom middleware in loopback?
thanks