Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const cors = require('cors');
- const scraper = require('./scraper.js');
- const app = express();
- app.use(cors());
- module.exports = app.get('/', (req, res) => {
- res.json({
- message: 'Working!'
- })
- });
- module.exports = app.get('/:title', (req, res) => {
- scraper
- .searchHltv(req.params.title)
- .then(searchResult => {
- res.json(searchResult)
- });
- });
- const port = process.env.PORT || 3000;
- module.exports = app.listen(port, () => {
- console.log(`Listening on port ${port}`);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement