Sewmina (server) 6 meses atrás
pai
commit
197bc54c91
3 arquivos alterados com 15 adições e 8 exclusões
  1. 6 6
      index.js
  2. 7 1
      package-lock.json
  3. 2 1
      package.json

+ 6 - 6
index.js

@@ -1,18 +1,18 @@
 const express = require('express');
-const { AvatarGenerator } = require('random-avatar-generator');
 
 const app = express();
 const port = 1854;
+const pfp = require('random-pfp');
 
 app.get('/getRandomLink', (req, res) => {
-  const randomAvatar = generator.generateRandomAvatar();
-  res.json({ avatarLink: randomAvatar });
+  res.json({ link: pfp() });
 });
 
-const generator = new AvatarGenerator();
 
-// Simply get a random avatar
-generator.generateRandomAvatar();
+
+app.get('/', (req, res)=>{
+    res.send(`<img src="${pfp()}" width="250px">`)
+})
 
 app.listen(port, () => {
     console.log(`Server running on port ${port}`);

+ 7 - 1
package-lock.json

@@ -10,7 +10,8 @@
       "license": "ISC",
       "dependencies": {
         "express": "^4.21.0",
-        "random-avatar-generator": "^2.0.0"
+        "random-avatar-generator": "^2.0.0",
+        "random-pfp": "^1.0.3"
       }
     },
     "node_modules/accepts": {
@@ -528,6 +529,11 @@
         "seedrandom": "^3.0.5"
       }
     },
+    "node_modules/random-pfp": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/random-pfp/-/random-pfp-1.0.3.tgz",
+      "integrity": "sha512-/64F+sxpR4aV01qpe0o6304uPDa7RhGmKYSwrSpx7ZQ02ZlEYBUdc3sOWeuEVvRNDeOWc6AfD+4m1/Dy4iezog=="
+    },
     "node_modules/range-parser": {
       "version": "1.2.1",
       "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",

+ 2 - 1
package.json

@@ -10,6 +10,7 @@
   "license": "ISC",
   "dependencies": {
     "express": "^4.21.0",
-    "random-avatar-generator": "^2.0.0"
+    "random-avatar-generator": "^2.0.0",
+    "random-pfp": "^1.0.3"
   }
 }