This template is an API with a 3-layer architecture using TypeScript and Express. The API uses Puppeteer to perform web scraping.
-
Clone the repository:
git clone https://github.com/frankymelero/scrapping-api-puppeteer-express cd scrapping-api-puppeteer-express
-
Install dependencies:
npm install
scrapping-api-puppeteer-express/
├── src/
│ ├── controllers/
│ │ └── scrape.controller.ts
│ ├── services/
│ │ └── scrape.service.ts
│ ├── repositories/
│ │ └── scrape.repository.ts
│ ├── routes/
│ │ └── scrape.route.ts
│ └── index.ts
├── package.json
├── tsconfig.json
└── README.md
-
Compile the project:
npm run build
-
Start the server:
npm start
This endpoint scrapes the provided URL to get the title.
-
URL:
/api/scrape
-
Method:
GET
-
Query Parameters:
url
(required): The URL of the website to scrape.
-
Response:
200 OK
: Returns the scraping result.400 Bad Request
: If the URL parameter is missing.500 Internal Server Error
: If an error occurs during scraping.
Example Request:
GET /api/scrape?url=https://example.com
Example result
{
"result": "Example Domain"
}
For any questions, feedback, or issues, please feel free to reach out:
- Linkedin: Linkedin
- GitHub Issues: Project Issues