https://github.com/kevelopment/harujs
JavaScript Web Framework built in TypeScript bringing in some Spring feelings.
https://github.com/kevelopment/harujs
framework koa nodejs web-application
Last synced: 12 months ago
JSON representation
JavaScript Web Framework built in TypeScript bringing in some Spring feelings.
- Host: GitHub
- URL: https://github.com/kevelopment/harujs
- Owner: kevelopment
- Created: 2021-02-04T08:01:09.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-07-19T01:20:14.000Z (over 2 years ago)
- Last Synced: 2024-05-01T13:29:43.760Z (almost 2 years ago)
- Topics: framework, koa, nodejs, web-application
- Language: TypeScript
- Homepage:
- Size: 518 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HaruJs

## Web framework for Node.js based on Koa
This Framework is supposed to bring the Spring-Boot feeling into JavaScript by providing the necessary Decorators for your Node.js Application.
## Available Components
### Modules
- `Application` The Entry Point of the Service, used to configure and set up the App.
### Decorators
- `RestController` Defines a Controller responsible for handling Restful Http-Requests
- `Get`, `Put`, `Post`, `Delete`, `Patch` Defines the Corresponding handling Methods of a Controller
### Configuration
A Configuration File (`haru.config.js` per default) can be provided via path-Parameter to the Application itself. Currenly the Configuration-File supports following Attributes:
- "port": number - the Port of the Application
This Configuration File shall in future be used to provide arbitrary Properties for the Application e.g. `databaseUrl`, `dbUser`, `dbPassword` and even custom Attributes that will be Resolved via `@Property('${foo}')`.
## Examples
Examples can be found in the `/samples` Folder of the Repository. The example Application is configured to start an Application with multiple Controllers and Endpoints using different kinds of configurations.
The very basic way to create a Hello-World example would be:
```ts
@RestController()
class HelloController {
@Get('/hello')
helloWorld = async (ctx: Context, next: Function): Promise => {
ctx.response.body = 'Hello World!';
return next();
};
}
const app = new Application({ controllers: [HelloController] });
app.initialize().start();
```