KazeDevID commited on
Commit
17262ee
·
verified ·
1 Parent(s): 0b35229

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +28 -0
  2. index.js +22 -0
  3. package.json +5 -0
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:latest
2
+
3
+ ENV CHROME_BIN=/usr/bin/chromium \
4
+ TZ=Asia/Jakarta \
5
+ DEBIAN_FRONTEND=noninteractive
6
+ RUN apt-get update && apt-get install -y \
7
+ chromium \
8
+ ffmpeg \
9
+ imagemagick \
10
+ libnss3-dev \
11
+ webp
12
+ RUN apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
13
+ libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
14
+ libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
15
+ libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
16
+ ca-certificates libappindicator1 libnss3 lsb-release xdg-utils
17
+ RUN apt-get install -y \
18
+ fonts-liberation \
19
+ fonts-dejavu \
20
+ fonts-noto-color-emoji \
21
+ libfontconfig1 --no-install-recommends
22
+ RUN apt-get clean && rm -rf /var/lib/apt/lists/*
23
+ WORKDIR /app
24
+ COPY package*.json $WORKDIR
25
+ RUN npm i
26
+ COPY . $WORKDIR
27
+ EXPOSE 7860
28
+ CMD ["node", "."]
index.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const express = require('express');
2
+ const app = express();
3
+ const port = 3000;
4
+
5
+ // Middleware untuk parsing JSON
6
+ app.use(express.json());
7
+
8
+ // Contoh data yang akan diberikan sebagai output
9
+ const data = [
10
+ { id: 1, name: 'John Doe', email: '[email protected]' },
11
+ { id: 2, name: 'Jane Smith', email: '[email protected]' },
12
+ { id: 3, name: 'Michael Johnson', email: '[email protected]' }
13
+ ];
14
+
15
+ // Endpoint GET untuk mendapatkan semua data
16
+ app.get('/api/data', (req, res) => {
17
+ res.json(data);
18
+ });
19
+
20
+ app.listen(port, () => {
21
+ console.log(`Server berjalan di http://localhost:${port}`);
22
+ });
package.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "dependencies": {
3
+ "express": "^4.17.1"
4
+ }
5
+ }