Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. const express = require('express');
  2. const cors = require('cors');
  3. const scraper = require('./scraper.js');
  4.  
  5. const app = express();
  6. app.use(cors());
  7.  
  8. module.exports = app.get('/', (req, res) => {
  9. res.json({
  10. message: 'Working!'
  11. })
  12. });
  13.  
  14. module.exports = app.get('/:title', (req, res) => {
  15. scraper
  16. .searchHltv(req.params.title)
  17. .then(searchResult => {
  18. res.json(searchResult)
  19. });
  20. });
  21.  
  22. const port = process.env.PORT || 3000;
  23. module.exports = app.listen(port, () => {
  24. console.log(`Listening on port ${port}`);
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement