We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28f8799 commit a6d2706Copy full SHA for a6d2706
src/gui/src/helpers/new_context_menu_item.js
@@ -164,8 +164,16 @@ const new_context_menu_item = function(dirname, append_to_element){
164
dirname: dirname,
165
append_to_element: append_to_element,
166
name: 'New Worker.js',
167
- content: `router.get('/', (req, res) => {
168
- return 'Hello World';
+ content: `// This is an example application for Puter Workers
+
169
+router.get('/', ({request}) => {
170
+ return 'Hello World'; // returns a string
171
+});
172
+router.get('/api/hello', ({request}) => {
173
+ return {'msg': 'hello'}; // returns a JSON object
174
175
+router.get('/*page', ({request, params}) => {
176
+ return new Response(\`Page \${params.page} not found\`, {status: 404});
177
});
178
`
179
0 commit comments