@angellahirwa7/simple_api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/index.js +11 -0
- package/license +15 -0
- package/package.json +18 -0
- package/test.js +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# simple-node-api
|
|
2
|
+
|
|
3
|
+
A tiny Node.js utility to quickly create a basic HTTP API using core Node.js modules.
|
|
4
|
+
|
|
5
|
+
This package is designed for beginners who want to understand how servers work without using frameworks like Express.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install simple-node-api
|
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const http = require('http')
|
|
2
|
+
function createServer(port = 5000) {
|
|
3
|
+
const server = http.createServer((req, res) => {
|
|
4
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
5
|
+
res.end(JSON.stringify("conglatulations you have officially built your first API"));
|
|
6
|
+
}
|
|
7
|
+
);
|
|
8
|
+
server.listen(5000);
|
|
9
|
+
console.log('server is listening on port 5000');
|
|
10
|
+
}
|
|
11
|
+
module.exports = {createServer };
|
package/license
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Angella
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@angellahirwa7/simple_api",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "this helps you create a simple API using node wiyhout hardcoding for Beginners",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node test.js"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "2"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"API"
|
|
15
|
+
],
|
|
16
|
+
"author": "Angella Hirwa",
|
|
17
|
+
"license": "ISC"
|
|
18
|
+
}
|
package/test.js
ADDED