@trenskow/app 0.7.1 → 0.7.4
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 +14 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,24 +124,24 @@ import { Application, Endpoint } from '@trenskow/app';
|
|
|
124
124
|
const app = new Application({ port: 8080 });
|
|
125
125
|
|
|
126
126
|
try {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
|
|
128
|
+
const root = new Endpoint()
|
|
129
|
+
.mount('iam', await import('./iam.js'));
|
|
130
|
+
|
|
131
|
+
const renderer = async ({ result, response }) => {
|
|
132
132
|
response.headers.contentType = 'text/plain';
|
|
133
133
|
response.end(result);
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
};
|
|
135
|
+
|
|
136
136
|
await app
|
|
137
137
|
.root(root)
|
|
138
138
|
.renderer(renderer)
|
|
139
|
-
.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
.open();
|
|
140
|
+
|
|
141
|
+
console.info(`Application is running on port ${app.port}`)
|
|
142
|
+
|
|
143
143
|
} catch (error) {
|
|
144
|
-
|
|
144
|
+
console.error(error);
|
|
145
145
|
}
|
|
146
146
|
````
|
|
147
147
|
|
|
@@ -515,8 +515,8 @@ Below is an example on how to use the method.
|
|
|
515
515
|
default export ({ endpoint }) => {
|
|
516
516
|
endpoint
|
|
517
517
|
.get(
|
|
518
|
-
|
|
519
|
-
|
|
518
|
+
async (context) => 'Hello, world!',
|
|
519
|
+
() => console.info("Said hello."));
|
|
520
520
|
};
|
|
521
521
|
````
|
|
522
522
|
|