Sewmina 6 kuukautta sitten
vanhempi
commit
9953a57902
2 muutettua tiedostoa jossa 19 lisäystä ja 0 poistoa
  1. 18 0
      index.js
  2. 1 0
      package-lock.json

+ 18 - 0
index.js

@@ -1,6 +1,24 @@
+
+const express = require('express');
 import { AvatarGenerator } from 'random-avatar-generator';
 
+const app = express();
+const port = 1854;
+
+app.get('/getRandomLink', (req, res) => {
+  const randomAvatar = generator.generateRandomAvatar();
+  res.json({ avatarLink: randomAvatar });
+});
+
+
+
 const generator = new AvatarGenerator();
 
 // Simply get a random avatar
 generator.generateRandomAvatar();
+
+
+app.listen(port, () => {
+    console.log(`Server running on port ${port}`);
+  });
+  

+ 1 - 0
package-lock.json

@@ -201,6 +201,7 @@
       "version": "4.21.0",
       "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz",
       "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==",
+      "license": "MIT",
       "dependencies": {
         "accepts": "~1.3.8",
         "array-flatten": "1.1.1",