Skip to content

Commit 6c84864

Browse files
committed
Fixed the API Endpoint Path and added Docs for Image and PDF
1 parent ce995e5 commit 6c84864

3 files changed

Lines changed: 31 additions & 11 deletions

File tree

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,46 @@
99
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.
1010

1111
## Motivation
12-
* https://screenshotlayer.com/
13-
* https://urlbox.io/
14-
* https://browshot.com/
15-
* https://screenshotmachine.com/
12+
13+
* [https://screenshotlayer.com/](https://screenshotlayer.com/)
14+
* [https://urlbox.io/](https://urlbox.io/)
15+
* [https://browshot.com/](https://browshot.com/)
16+
* [https://screenshotmachine.com/](https://screenshotmachine.com/)
1617

1718
## Demo
19+
1820
[https://screenshotcrew.com/](https://screenshotcrew.com/)
1921

2022
## API Reference
2123

24+
### Image
25+
2226
```bash
23-
curl --location --request GET "https://screenshotcrew.com/api/capture?width=1920&url=https://gaurangjadia.com"
27+
curl --location --request GET "https://screenshotcrew.com/api/capture/image?width=1920&url=https://gaurangjadia.com"
2428
```
2529

2630
```bash
27-
curl --location --request POST "https://screenshotcrew.com/api/capture" --header "Content-Type: application/json" --data-raw "{
31+
curl --location --request POST "https://screenshotcrew.com/api/capture/image" --header "Content-Type: application/json" --data-raw "{
2832
\"width\": 1920,
2933
\"url\": \"https://gaurangjadia.com\"
3034
}"
3135
```
3236

37+
### PDF
38+
39+
```bash
40+
curl --location --request GET "https://screenshotcrew.com/api/capture/pdf?pageSize=A4&url=https://gaurangjadia.com"
41+
```
42+
43+
```bash
44+
curl --location --request POST "https://screenshotcrew.com/api/capture/pdf" --header "Content-Type: application/json" --data-raw "{
45+
\"pageSize\": \"A4\",
46+
\"url\": \"https://gaurangjadia.com\"
47+
}"
48+
```
49+
3350
## Installation
51+
3452
```base
3553
npm install
3654
npm update
@@ -58,9 +76,11 @@ docker run -d -p 80:80 jadiagaurang/screenshotcrew
5876
```
5977

6078
## Tests
79+
6180
```base
6281
npm test
6382
```
6483

6584
## License
85+
6686
Please see the [license file](https://github.com/jadiagaurang/ScreenshotCrew/blob/main/LICENSE) for more information.

app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const { createTerminus } = require("@godaddy/terminus")
1515

1616
// Load local plugins
1717
const winston = require("./src/logger").winston;
18-
const routes = require("./routes/index");
19-
const shotbot = require('./routes/shotbot');
18+
const routesViews = require("./routes/index");
19+
const routesAPIEndpoints = require('./routes/shotbot');
2020
var meLogger = winston(process.env.LOG_LEVEL);
2121

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

5656
// WebApp and API Route Setup
57-
app.use("/", routes);
58-
app.use("/api", shotbot);
57+
app.use("/", routesViews);
58+
app.use("/api", routesAPIEndpoints);
5959

6060
// Catch 404 and forward to error handler
6161
app.use(function (req, res, next) {

views/partials/footer.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939
4040
let xhr = $.ajax({
41-
url: "/api/capture",
41+
url: "/api/capture/image",
4242
method: "POST",
4343
data: {
4444
"url": varURL

0 commit comments

Comments
 (0)