1.0.28 • Published 6 months ago

avrasya v1.0.28

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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

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.

1.0.28

6 months ago

1.0.27

6 months ago

1.0.26

6 months ago

1.0.25

6 months ago

1.0.24

6 months ago

1.0.22

6 months ago

1.0.21

6 months ago

1.0.20

6 months ago

1.0.19

6 months ago

1.0.18

6 months ago

1.0.17

6 months ago

1.0.16

6 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago