@baris No error, exept a "not found" on every route of libray.js
I feel silly. I hadn't thought to use an older version. It works ! Thank you very much !!!!
@baris No error, exept a "not found" on every route of libray.js
I feel silly. I hadn't thought to use an older version. It works ! Thank you very much !!!!
@baris I just try and it doesn't change anything
Does it mean I will have to edit the base js of nodeBB to convert it to esm ?
@PitaJ It's the first think I try, like I will do for any classical node projet. It doesn't work. I uust try again and it seems to block. NodeBB can't find my routes
Hello !
I follow the doc to import an external library in my plugin (https://github.com/PokeAPI/pokedex-promise-v2)
I my library.js, in plugin.init, I add this :
routeHelpers.setupPageRoute(router, '/pokemon/:param1', [(req, res, next) => {
winston.info(`[plugins/pokemon] In middleware. This argument can be either a single middleware or an array of middlewares`); setImmediate(next);
}], async (req, res) => {
const pokemonName = req.params.param1; let pokemonSpec, frenchName require('pokedex-promise-v2', async (Pokedex) => { const P = new Pokedex(); pokemonSpec = await P.getPokemonSpeciesByName(pokemonName); // // pokemonSpec = await P.getCharacteristicById(pokemonName); frenchName = pokemonSpec.names.filter(pokeAPIName => pokeAPIName.language.name === 'fr')[0].name; }); winston.info(`[plugins/pokemon] Navigated to ${nconf.get('relative_path')}/pokemon`); res.render('pokemon', { pokemon: pokemonName, frenchName : frenchName });
});
In plugin.json, I have this
"modules": {
"../client/quickstart.js": "./static/lib/quickstart.js", "../admin/plugins/quickstart.js": "./static/lib/admin.js", "pokedex-promise-v2" : "./node_modules/pokedex-promise-v2"
},
When I try to go on the route, I have this error :
What I am doing wrong ?