Skip to content

Commit

Permalink
Update -> A simple logger added to core (it will improve and develope.)
Browse files Browse the repository at this point in the history
Feature -> custom host for listening server.
Feature -> handle server errors by logger.
Feature -> core config (not completed but a simple logic created)
Feature -> route prefix. for example: set /hello -> save /api/v1/hello
Doc -> router changed from class to function to handle and making instances easier.
  • Loading branch information
MR-MKZ committed Sep 8, 2024
1 parent 9bd4e19 commit 8d877b4
Show file tree
Hide file tree
Showing 16 changed files with 598 additions and 37 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Install Axon.js with npm
- Support middlewares.
- Some changes in response structure.
- Response meta generator.
- Logger system.
- Logger system. [In Progress]
- Auto error detector (maybe)
- Default schemas.
- Default database connection methods.
Expand All @@ -74,8 +74,14 @@ import { HttpRouterCore, Router } from "@mr-mkz/axon";

// Axon core instance
const core = new HttpRouterCore();
// Router instance
const router = new Router();

// configuring core (not completed)
core.loadConfig({
DEBUG: true
})

// Router instance function
const router = Router();

// route with method GET.
// all methods: [get, post, put, patch, delete, options]
Expand All @@ -91,8 +97,11 @@ router.get('/', async () => {
// Giving routes to Axon core
core.loadRoute(router)

// Giving routes to Axon core with prefix
core.loadRoute(router, "/api/v1")

// Starting server
core.listen(8000, () => {
core.listen(8000, "127.0.0.1", () => {
console.log("Listening on port 8000...")
})
```
Expand Down
Loading

0 comments on commit 8d877b4

Please sign in to comment.