genkid2020

Untitled

Aug 9th, 2020
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. const fetch = require('node-fetch');
  2. const parser = () => {
  3. var stack=[];
  4. // READ
  5. try {
  6. fetch('https://api.hh.ru/vacancies?page=1')
  7. .then(res => res.text())
  8. .then(body => {
  9. const data = JSON.parse(body);
  10. const output = data.items.map(({id, name, snippet: requirement}) => ({
  11. id,
  12. name,
  13. snippet: requirement
  14. }));
  15. res.send(output);
  16. });
  17. }catch (err) {
  18. console.log(err);
  19. stack.push(err);
  20. next(err);
  21. }
  22. };
  23.  
  24. module.exports = parser;
  25.  
Add Comment
Please, Sign In to add comment