diff --git a/flake.nix b/flake.nix
index 4c5e915..bdcf963 100644
--- a/flake.nix
+++ b/flake.nix
@@ -39,6 +39,7 @@
nativeBuildInputs = with pkgs; [ python3 ];
npmDepsHash = hashesFile.npmDepsHash;
makeCacheWritable = true;
+ dontNpmBuild = true;
postPatch = ''
substituteInPlace package.json --replace 'npx patch-package' '${pkgs.nodePackages.patch-package}/bin/patch-package'
'';
@@ -50,8 +51,8 @@
find node_modules -maxdepth 1 -type d -empty -delete
mkdir -p $out
- cp -r assets dist node_modules package.json $out/
- makeWrapper ${pkgs.nodejs}/bin/node $out/bin/start --prefix NODE_PATH : $out/node_modules --add-flags $out/$i
+ cp -r src node_modules package.json $out/
+ makeWrapper ${pkgs.nodejs}/bin/node $out/bin/start --prefix NODE_PATH : $out/node_modules --add-flags $out
set +x
runHook postInstall
@@ -78,9 +79,6 @@
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
- nodePackages.typescript
- nodePackages.ts-node
- nodePackages.patch-package
nodePackages.prettier
];
};
diff --git a/hashes.json b/hashes.json
index 7bee6e9..35acf15 100644
--- a/hashes.json
+++ b/hashes.json
@@ -1,3 +1,3 @@
{
- "npmDepsHash": "sha256-moMLyLAQ+sHfhc5zJfC/quKTM1M/M3bFziOPGKP30Ys="
+ "npmDepsHash": "sha256-X4ILC6lL+THrUg04KgIw7KAatCeuIgMgsYAgrLFtHjI="
}
diff --git a/package.json b/package.json
index 9d2c557..d65d404 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,8 @@
"name": "nodejs-final-assignment",
"version": "1.0.0",
"description": "[](https://classroom.github.com/a/3A9ByVp3)",
- "main": "index.js",
+ "main": "src/api/start.js",
+ "type": "module",
"scripts": {
"prepare": "husky install"
},
diff --git a/src/api/start.js b/src/api/start.js
new file mode 100644
index 0000000..9d9c586
--- /dev/null
+++ b/src/api/start.js
@@ -0,0 +1,12 @@
+import express from "express";
+
+const app = express();
+const PORT = process.env.PORT || 3000;
+
+app.get("/", (req, res) => {
+ res.send("Welcome to the API!");
+});
+
+app.listen(PORT, () => {
+ console.log(`Server is running on http://localhost:${PORT}`);
+});
|