alipackage 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 ADDED
File without changes
Binary file
package/app.cjs ADDED
@@ -0,0 +1,9 @@
1
+ // app.cjs
2
+ const express = require("express");
3
+ const alipackage = require("alipackage");
4
+
5
+ const app = express();
6
+ alipackage(app);
7
+
8
+ app.listen(3000);
9
+ console.log("Server running on http://localhost:3000");
package/app.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import express from "express";
2
+ import alipackage from "alipackage";
3
+
4
+ const app = express();
5
+ alipackage(app);
6
+
7
+ app.listen(3000, () => {
8
+ console.log("Server running on port 3000");
9
+ });
package/index.cjs ADDED
@@ -0,0 +1,12 @@
1
+ function mypackage(app) {
2
+ if (!app || !app.get) {
3
+ throw new Error("Express app instance required");
4
+ }
5
+
6
+ app.get("/mypackage", (req, res) => {
7
+ console.log(`${req.method} request for '${req.url}'`);
8
+ res.send("mypackage route accessed.....");
9
+ });
10
+ }
11
+
12
+ module.exports = mypackage;
package/index.mjs ADDED
@@ -0,0 +1,10 @@
1
+ export default function mypackage(app) {
2
+ if (!app || !app.get) {
3
+ throw new Error("Express app instance required");
4
+ }
5
+
6
+ app.get("/mypackage", (req, res) => {
7
+ console.log(`${req.method} request for '${req.url}'`);
8
+ res.send("mypackage route accessed.....");
9
+ });
10
+ }
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "alipackage",
3
+ "version": "1.0.0",
4
+ "description": "My first npm package",
5
+ "main": "index.cjs",
6
+ "exports": {
7
+ "require": "./index.cjs",
8
+ "import": "./index.mjs"
9
+ },
10
+ "keywords": ["express", "middleware"],
11
+ "author": "Muddassir Ali",
12
+ "license": "MIT"
13
+ }