Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get('/', (req, res) => {
- res.send("Welcome!")
- })
- app.get('*', (req, res) => {
- jsonfile.readFile(file, (err, obj) => {
- let pokedex = obj.pokemon
- let result = []
- let format = req.path.split('/');
- let userPath = format[1]
- for (var i = 0; i < pokedex.length; i++) {
- if (userPath == pokedex[i].name.toLowerCase()) {
- result.push(
- "<h1>" + pokedex[i].name + "</h1><ul>Weight: " + pokedex[i].weight + "</ul>" );
- }
- }
- res.send(result.join())
- })
- })
Add Comment
Please, Sign In to add comment