fetch.js 426 B

1234567891011121314
  1. /**
  2. * React Starter Kit (https://www.reactstarterkit.com/)
  3. *
  4. * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
  5. *
  6. * This source code is licensed under the MIT license found in the
  7. * LICENSE.txt file in the root directory of this source tree.
  8. */
  9. import http from 'http';
  10. export default async (url) => new Promise((resolve, reject) =>
  11. http.get(url, res => resolve(res)).on('error', err => reject(err))
  12. );