Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fetch = require('node-fetch');
- const hhroute = (app) => {
- // READ
- app.get('/', function (req, res) {
- fetch('https://api.hh.ru/vacancies?page=1')
- .then(res=>res.text())
- .then(body=> {
- const data = JSON.parse(body);
- const output = data.items.map(({id,name,snippet:requirement}) => ({id,name,snippet:requirement}));
- res.send(output);
- });
- });
- };
- module.exports = hhroute;
Add Comment
Please, Sign In to add comment