Closed abhi18av closed 8 years ago
Hi, thanks for using this wrapper.
You are getting that error because res
is not defined. Usually, this wrapper is used along express.js which lets you do the following:
var express = require('express');
var app = express();
app.get('/', function (req, res) { // res here is a parameter
res.send('Hello World!'); //you use it for serving content to clients
});
So in the examples we use res
to show how to serve the content retrieved from the PokeAPI while using express.
To test if your installation works fine just use this code:
var Pokedex = require('pokedex-promise-v2');
var P = new Pokedex();
P.getBerryByName('chesto')
.then(function(response) {
console.log(response);
})
It will log you the response
Object. No need to use res
and express
Ah, yes now it works perfectly! I appreciate the explanation. Grazie Allesandro! 👍
Hey, I'm trying to use the wonderful wrapper in NodeJS but for some reason I'm unable to get this thing running. I'm a passionate noob starting out with the Web so could you please help me out a bit.
Here are the specs
'''bash There was an ERROR: [ReferenceError: res is not defined] '''
Directory setup
├── node_modules │ ├── pokedex-promise-v2 │ └── promise ├── package.json └── pokefile1.js