From 62215dfc4c2b8e96524057197c1e122b258d3cc2 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Wed, 3 May 2023 23:52:12 -0400 Subject: plain webserver using vanilla v8 --- part2/countrydata/README.md | 2 +- practice/index.js | 10 ++++++++++ practice/package.json | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 practice/index.js create mode 100644 practice/package.json diff --git a/part2/countrydata/README.md b/part2/countrydata/README.md index ceb8e8a..3ba4f09 100644 --- a/part2/countrydata/README.md +++ b/part2/countrydata/README.md @@ -4,4 +4,4 @@ pulled from https://restcountries.com/#endpoints-all via its REST API # Example use ![example use](./example_use.png) - + 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" +} -- cgit v1.2.3