avrasya
v1.0.28
Published
Avrasya is a fast and unique Node.js web framework designed for building web applications and APIs. Avrasya stands out with its simple usage, performance, and extensibility.
Downloads
186
Readme
Avrasya Web Framework
Features
- Simple and user-friendly API
- Fast and efficient
- Middleware support
- Extensibility
- Open-source and free
Getting Started
To get started with Avrasya, follow these steps:
- Add Avrasya to your project:
npm install avrasya
- Create your web server:
import Avrasya from "avrasya";
const avrasya = new Avrasya();
avrasya.router.get("/", (context) => {
context.send("Hello World");
});
avrasya.use((context, next) => {
console.log("middleware1");
console.log(context.req.url + " " + context.req.method);
next();
})
avrasya.use((context, next) => {
console.log("middleware2");
next();
})
avrasya.use((context, next) => {
console.log("middleware3");
next();
})
avrasya.listen(3000);
File Based Routing
| src
| index.ts
| routes
| get.ts
| user
| get.ts
| [id]
| get.ts
| post.ts
get.ts Example Handler
import Context from "avrasya/src/context";
const get = (context: Context) => {
context.send("Hello World");
}
export default get
See Example for more details.
Installation
To get started with Avrasya, follow these simple installation steps:
- Clone the Repository:
git clone https://github.com/muhtalipdede/avrasya.git
- Navigate to the Project Directory:
cd avrasya
- Install Dependencies:
npm install
- Start the Application:
npm run start
Content Type Support
Serving CSS
avrasya.router.get("/css", (context) => {
const css = `
body {
background-color: red;
}
`;
context.css(css);
});
Serving Javascript
avrasya.router.get("/js", (context) => {
const js = `
console.log("Hello World");
`;
context.js(js);
});
Serving HTML
avrasya.router.get("/html", (context) => {
const html = `
<h1>Hello World</h1>
<p>Avrasya is a fast and unique Node.js web framework designed for building web applications and APIs. Avrasya stands out with its simple usage, performance, and extensibility.</p>
<button>Click me</button>
`;
context.html(html);
});
Serving JSON
avrasya.router.get("/json", (context) => {
const json = {
name: "Avrasya",
version: "1.0.13",
description: "Avrasya is a fast and unique Node.js web framework designed for building web applications and APIs. Avrasya stands out with its simple usage, performance, and extensibility."
};
context.json(json);
});
Serving Plain Text
avrasya.router.get("/text", (context) => {
const text = "Avrasya is a fast and unique Node.js web framework designed for building web applications and APIs. Avrasya stands out with its simple usage, performance, and extensibility.";
context.text(text);
});
Serving Files
avrasya.router.get("/image", (context) => {
const path = "avrasya.png";
context.file(path);
});
Redirecting
avrasya.router.get("/redirect", (context) => {
context.redirect("https://www.google.com");
});
Contribution Guidelines
Thank you for considering contributing to this project! CONTRIBUTING
Contributors
Check out the list of contributors in the CONTRIBUTORS file.
Issue Template
If you want to report an issue or request a new feature, please use the following template. ISSUE_TEMPLATE
License
This project is licensed under the MIT License. For more information, please refer to the LICENSE File.