Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fetch = require('node-fetch');
- const parser = () => {
- var stack=[];
- // READ
- try {
- 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);
- });
- }catch (err) {
- console.log(err);
- stack.push(err);
- next(err);
- }
- };
- module.exports = parser;
Add Comment
Please, Sign In to add comment