You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]
'''
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
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
The text was updated successfully, but these errors were encountered: