Skip to content

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.

License

Notifications You must be signed in to change notification settings

ThinkThread/avrasya

Repository files navigation

Avrasya Web Framework

NPM Version NPM Install Size NPM Downloads Known Vulnerabilities Bugs Security Rating Maintainability Rating Code Smells Lines of Code Reliability Rating Duplicated Lines (%) CodeFactor Codacy Badge Coverage

drawing

Official Website

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.

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:

  1. Add Avrasya to your project:
npm install avrasya
  1. 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:

  1. Clone the Repository:
git clone https://github.com/muhtalipdede/avrasya.git
  1. Navigate to the Project Directory:
cd avrasya
  1. Install Dependencies:
npm install
  1. 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.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published