Skip to content

Commit

Permalink
Fixed the API Endpoint Path and added Docs for Image and PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
jadiagaurang committed Nov 8, 2022
1 parent ce995e5 commit 6c84864
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,46 @@
ScreenshotCrew is an open-source screenshot as a service using [Puppeteer headless browser](https://github.com/puppeteer/puppeteer). Using Node.js, [Puppeteer](https://pptr.dev/) and other plugins, ScreenshotCrew provides utility tool to create screenshot from any web page.

## Motivation
* https://screenshotlayer.com/
* https://urlbox.io/
* https://browshot.com/
* https://screenshotmachine.com/

* [https://screenshotlayer.com/](https://screenshotlayer.com/)
* [https://urlbox.io/](https://urlbox.io/)
* [https://browshot.com/](https://browshot.com/)
* [https://screenshotmachine.com/](https://screenshotmachine.com/)

## Demo

[https://screenshotcrew.com/](https://screenshotcrew.com/)

## API Reference

### Image

```bash
curl --location --request GET "https://screenshotcrew.com/api/capture?width=1920&url=https://gaurangjadia.com"
curl --location --request GET "https://screenshotcrew.com/api/capture/image?width=1920&url=https://gaurangjadia.com"
```

```bash
curl --location --request POST "https://screenshotcrew.com/api/capture" --header "Content-Type: application/json" --data-raw "{
curl --location --request POST "https://screenshotcrew.com/api/capture/image" --header "Content-Type: application/json" --data-raw "{
\"width\": 1920,
\"url\": \"https://gaurangjadia.com\"
}"
```

### PDF

```bash
curl --location --request GET "https://screenshotcrew.com/api/capture/pdf?pageSize=A4&url=https://gaurangjadia.com"
```

```bash
curl --location --request POST "https://screenshotcrew.com/api/capture/pdf" --header "Content-Type: application/json" --data-raw "{
\"pageSize\": \"A4\",
\"url\": \"https://gaurangjadia.com\"
}"
```

## Installation

```base
npm install
npm update
Expand Down Expand Up @@ -58,9 +76,11 @@ docker run -d -p 80:80 jadiagaurang/screenshotcrew
```

## Tests

```base
npm test
```

## License

Please see the [license file](https://github.com/jadiagaurang/ScreenshotCrew/blob/main/LICENSE) for more information.
8 changes: 4 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const { createTerminus } = require("@godaddy/terminus")

// Load local plugins
const winston = require("./src/logger").winston;
const routes = require("./routes/index");
const shotbot = require('./routes/shotbot');
const routesViews = require("./routes/index");
const routesAPIEndpoints = require('./routes/shotbot');
var meLogger = winston(process.env.LOG_LEVEL);

// ExpressJS App Setup
Expand Down Expand Up @@ -54,8 +54,8 @@ app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public")));

// WebApp and API Route Setup
app.use("/", routes);
app.use("/api", shotbot);
app.use("/", routesViews);
app.use("/api", routesAPIEndpoints);

// Catch 404 and forward to error handler
app.use(function (req, res, next) {
Expand Down
2 changes: 1 addition & 1 deletion views/partials/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}
let xhr = $.ajax({
url: "/api/capture",
url: "/api/capture/image",
method: "POST",
data: {
"url": varURL
Expand Down

0 comments on commit 6c84864

Please sign in to comment.