Browse Source

vibe-d web app init

221V 2 weeks ago
commit
64f8c6b3db
7 changed files with 107 additions and 0 deletions
  1. 16 0
      README.md
  2. 16 0
      comp.mk
  3. 16 0
      vtest/.gitignore
  4. 3 0
      vtest/Makefile
  5. 15 0
      vtest/dub.json
  6. 19 0
      vtest/dub.selections.json
  7. 22 0
      vtest/source/app.d

+ 16 - 0
README.md

@@ -0,0 +1,16 @@
+# dlang vibe.d simple web app
+
+```
+// vibe-d 0.10.2
+
+
+$ cd <FOLDER_NAME>
+$ make c
+
+
+$ ldc2 -v
+binary    /home/e/.dlang/bin/ldc2
+version   1.39.0 (DMD v2.109.1, LLVM 18.1.6)
+config    /home/e/.dlang/etc/ldc2.conf (x86_64-unknown-linux-gnu)
+```
+

+ 16 - 0
comp.mk

@@ -0,0 +1,16 @@
+
+
+# todo clean
+
+c:
+	dub build --compiler ldc2 --build release --force
+
+run:
+	./vtest
+
+
+
+default: run
+
+.PHONY: c run
+

+ 16 - 0
vtest/.gitignore

@@ -0,0 +1,16 @@
+.dub
+docs.json
+__dummy.html
+docs/
+/vtest
+vtest.so
+vtest.dylib
+vtest.dll
+vtest.a
+vtest.lib
+vtest-test-*
+*.exe
+*.pdb
+*.o
+*.obj
+*.lst

+ 3 - 0
vtest/Makefile

@@ -0,0 +1,3 @@
+
+include ../comp.mk
+

+ 15 - 0
vtest/dub.json

@@ -0,0 +1,15 @@
+{
+  "name": "vtest",
+  "description": "A simple vibe.d server application.",
+  
+  "targetName": "vtest",
+  "dflags": ["-w", "-O", "-static"],
+  "targetType": "executable",
+  "dependencies": {
+    "vibe-d": "~>0.9"
+  },
+  
+  "license": "proprietary",
+  "copyright": "Copyright © 2025, 221V",
+  "authors": [ "221V" ]
+}

+ 19 - 0
vtest/dub.selections.json

@@ -0,0 +1,19 @@
+{
+	"fileVersion": 1,
+	"versions": {
+		"diet-ng": "1.8.4",
+		"eventcore": "0.9.35",
+		"mir-linux-kernel": "1.2.1",
+		"openssl": "3.3.4",
+		"openssl-static": "1.0.5+3.0.8",
+		"stdx-allocator": "2.77.5",
+		"taggedalgebraic": "0.11.23",
+		"vibe-container": "1.6.2",
+		"vibe-core": "2.11.0",
+		"vibe-d": "0.10.2",
+		"vibe-http": "1.2.2",
+		"vibe-inet": "1.1.2",
+		"vibe-serialization": "1.1.1",
+		"vibe-stream": "1.1.1"
+	}
+}

+ 22 - 0
vtest/source/app.d

@@ -0,0 +1,22 @@
+
+import vibe.vibe;
+
+void main()
+{
+	auto settings = new HTTPServerSettings;
+	settings.port = 8080;
+	settings.bindAddresses = ["::1", "127.0.0.1"];
+	auto listener = listenHTTP(settings, &hello);
+	scope (exit)
+	{
+		listener.stopListening();
+	}
+
+	logInfo("Please open http://127.0.0.1:8080/ in your browser.");
+	runApplication();
+}
+
+void hello(HTTPServerRequest req, HTTPServerResponse res)
+{
+	res.writeBody("Hello, World!");
+}