@stanlemon/app-template 0.2.51 → 0.3.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/app.js +6 -5
- package/package.json +4 -2
package/app.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAppServer,
|
|
3
3
|
asyncJsonHandler as handler,
|
|
4
|
-
|
|
4
|
+
LowDBUserDao,
|
|
5
5
|
} from "@stanlemon/server-with-auth";
|
|
6
|
+
import { v4 as uuid } from "uuid";
|
|
6
7
|
|
|
7
|
-
const dao = new
|
|
8
|
-
export const db = dao.
|
|
8
|
+
const dao = new LowDBUserDao();
|
|
9
|
+
export const db = dao.getDB();
|
|
9
10
|
db.data.items = db.data.items || [];
|
|
10
11
|
|
|
11
12
|
const app = createAppServer({
|
|
12
13
|
webpack: "http://localhost:8080",
|
|
13
14
|
secure: ["/api/"],
|
|
14
|
-
|
|
15
|
+
dao,
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
app.get(
|
|
@@ -22,7 +23,7 @@ app.get(
|
|
|
22
23
|
app.post(
|
|
23
24
|
"/api/items",
|
|
24
25
|
handler(async ({ item }) => {
|
|
25
|
-
db.data.items.push({ item, id:
|
|
26
|
+
db.data.items.push({ item, id: uuid() });
|
|
26
27
|
await db.write();
|
|
27
28
|
return db.data.items;
|
|
28
29
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stanlemon/app-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A template for creating apps using the webdev package.",
|
|
5
5
|
"author": "Stan Lemon <stanlemon@users.noreply.github.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"tsc": "tsc",
|
|
12
12
|
"webpack:serve": "webpack serve",
|
|
13
13
|
"webpack:build": "NODE_ENV=production webpack",
|
|
14
|
+
"dev": "concurrently \"npm run webpack:serve\" \"npm run start\"",
|
|
14
15
|
"test": "jest",
|
|
15
16
|
"test:watch": "jest -w",
|
|
16
17
|
"test:coverage": "jest --coverage",
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
"@testing-library/user-event": "^14.5.1",
|
|
29
30
|
"@types/react": "^18.2.21",
|
|
30
31
|
"@types/react-dom": "^18.2.7",
|
|
32
|
+
"concurrently": "^8.2.1",
|
|
31
33
|
"supertest": "^6.3.3"
|
|
32
34
|
}
|
|
33
|
-
}
|
|
35
|
+
}
|