Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -8,6 +8,8 @@ const loadImg = require('./loader');
|
|
| 8 |
const app = express();
|
| 9 |
const port = 7860;
|
| 10 |
|
|
|
|
|
|
|
| 11 |
//Security
|
| 12 |
app.use(helmet());
|
| 13 |
const limiter = rateLimit({
|
|
@@ -229,6 +231,7 @@ function wrapText(ctx, text, x, y, maxWidth, lineHeight) {
|
|
| 229 |
app.get('*', (req, res) => {
|
| 230 |
const documentation = {
|
| 231 |
description: 'Express.js API documentation for generating image status WhatsApp using canvas',
|
|
|
|
| 232 |
endpoints: [
|
| 233 |
{
|
| 234 |
method: 'POST',
|
|
@@ -280,6 +283,7 @@ app.get('*', (req, res) => {
|
|
| 280 |
|
| 281 |
app.post('/generate', async (req, res) => {
|
| 282 |
const { profileImage, mainImage, caption, views } = req.body;
|
|
|
|
| 283 |
|
| 284 |
if (!profileImage || !mainImage) {
|
| 285 |
return res.status(400).json({ error: "Gambar profil dan gambar utama harus disediakan." });
|
|
@@ -298,6 +302,7 @@ app.post('/generate', async (req, res) => {
|
|
| 298 |
app.post('/generate2', async (req, res) => {
|
| 299 |
try {
|
| 300 |
const { username, avatar, text, countLike } = req.body;
|
|
|
|
| 301 |
|
| 302 |
// Validasi input
|
| 303 |
if (!username || !text || !avatar) {
|
|
|
|
| 8 |
const app = express();
|
| 9 |
const port = 7860;
|
| 10 |
|
| 11 |
+
let totalReq = 0;
|
| 12 |
+
|
| 13 |
//Security
|
| 14 |
app.use(helmet());
|
| 15 |
const limiter = rateLimit({
|
|
|
|
| 231 |
app.get('*', (req, res) => {
|
| 232 |
const documentation = {
|
| 233 |
description: 'Express.js API documentation for generating image status WhatsApp using canvas',
|
| 234 |
+
totalRequest: totalReq,
|
| 235 |
endpoints: [
|
| 236 |
{
|
| 237 |
method: 'POST',
|
|
|
|
| 283 |
|
| 284 |
app.post('/generate', async (req, res) => {
|
| 285 |
const { profileImage, mainImage, caption, views } = req.body;
|
| 286 |
+
totalReq++;
|
| 287 |
|
| 288 |
if (!profileImage || !mainImage) {
|
| 289 |
return res.status(400).json({ error: "Gambar profil dan gambar utama harus disediakan." });
|
|
|
|
| 302 |
app.post('/generate2', async (req, res) => {
|
| 303 |
try {
|
| 304 |
const { username, avatar, text, countLike } = req.body;
|
| 305 |
+
totalReq++;
|
| 306 |
|
| 307 |
// Validasi input
|
| 308 |
if (!username || !text || !avatar) {
|