@trenskow/app 0.7.0 → 0.7.1

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.
@@ -5,7 +5,7 @@
5
5
  "version": "0.2.0",
6
6
  "configurations": [
7
7
  {
8
- "type": "pwa-node",
8
+ "type": "node",
9
9
  "request": "launch",
10
10
  "name": "Test",
11
11
  "skipFiles": [
package/README.md CHANGED
@@ -123,21 +123,26 @@ import { Application, Endpoint } from '@trenskow/app';
123
123
 
124
124
  const app = new Application({ port: 8080 });
125
125
 
126
- (async () => {
127
-
128
- return (await app
129
- .root(
130
- new Endpoint()
131
- .mount('iam', await import('./iam.js')))
132
- .renderer(async ({ result, response }) => {
126
+ try {
127
+
128
+ const root = new Endpoint()
129
+ .mount('iam', await import('./iam.js'));
130
+
131
+ const renderer = async ({ result, response }) => {
133
132
  response.headers.contentType = 'text/plain';
134
133
  response.end(result);
135
- })
136
- .start())
137
- .port;
138
-
139
- })().then((port) => console.info(`Application is running on port ${app.port}`))
140
- .catch(console.error);
134
+ };
135
+
136
+ await app
137
+ .root(root)
138
+ .renderer(renderer)
139
+ .start();
140
+
141
+ console.info(`Application is running on port ${app.port}`)
142
+
143
+ } catch (error) {
144
+ console.error(error);
145
+ }
141
146
  ````
142
147
 
143
148
  ````javascript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/app",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "A small HTTP router.",
5
5
  "type": "module",
6
6
  "main": "index.js",