In my Node project I'm using es6 imports instead of commonjs' require()
.
I've found this snippet to map through a folder and insert the files as the second argument to app.use()
:
readdirSync('./routes').map(r => app.use('/', require('./routes/' r)));
Can I translate this to es6 import syntax?