aboutsummaryrefslogtreecommitdiff
path: root/practice
diff options
context:
space:
mode:
authorIbrahim Mkusa <ibrahimmkusa@gmail.com>2023-05-03 23:52:12 -0400
committerIbrahim Mkusa <ibrahimmkusa@gmail.com>2023-05-03 23:52:12 -0400
commit62215dfc4c2b8e96524057197c1e122b258d3cc2 (patch)
tree4b75f80c04e3ac6f47c4e7ebbb5866409e058cb8 /practice
parent6610ee7aec692cd5c913a2853f16d3f1030c19bf (diff)
plain webserver using vanilla v8
Diffstat (limited to 'practice')
-rw-r--r--practice/index.js10
-rw-r--r--practice/package.json12
2 files changed, 22 insertions, 0 deletions
diff --git a/practice/index.js b/practice/index.js
new file mode 100644
index 0000000..c916bed
--- /dev/null
+++ b/practice/index.js
@@ -0,0 +1,10 @@
+const http = require('http')
+
+const app = http.createServer((request, response) => {
+ response.writeHead(200, { 'Content-Type': 'text/plain' })
+ response.end('Habari Tanzania')
+})
+
+const PORT = 3001
+app.listen(PORT)
+console.log(`Server running on port ${PORT}`)
diff --git a/practice/package.json b/practice/package.json
new file mode 100644
index 0000000..38b18da
--- /dev/null
+++ b/practice/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "funwithnode",
+ "version": "1.0.0",
+ "description": "root to test drive node and expres",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "start": "node ./index.js"
+ },
+ "author": "Ibrahim Mkusa",
+ "license": "MIT"
+}