Daniel-Boll / axum-js

A Axum http wrapper for NodeJS
MIT License
5 stars 3 forks source link

Extend get Method to Support Callbacks #3

Closed Daniel-Boll closed 1 year ago

Daniel-Boll commented 1 year ago

The current implementation of the get method in axum-js only accepts a string argument for specifying the path. To enhance its functionality and align with common JavaScript/TypeScript practices, it is essential to extend the get method to also accept a callback function. This callback function should be executed when the route is accessed.

Currently:

app.get('/', (req, res) => {
  res.send('Hello World!')
});

The callback function provides a mechanism to handle requests and send responses, enabling more dynamic and interactive API endpoints.

Acceptance Criteria:

Additional Context:

Supporting callbacks is a step towards making axum-js more flexible and user-friendly, aligning with common patterns used in JavaScript and TypeScript-based server frameworks.