1.0.1 • Published 3 years ago

@econw/anthrax v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Anthrax, or AnthraxJS, is an easy and open-source framework written using Node.js. Anthrax allows for rapid prototyping code. Motivated by ExpressJS.

Installation

$ npm install Anthrax

Hello Anthrax

import { AnthraxFactory } from "anthrax"
import { Methods } from "../src/interfaces/IApplication"

class AuthController {
	routes = [
		{
			path: "/login",
			method: Methods.GET,
			callBack: this.login,
		},
		{
			path: "/register",
			method: Methods.GET,
			callBack: this.register,
		},
	]

	async login(req: any, res: any) {
		return res.json(String(res))
	}
	async register(req: any, res: any) {
		return res.send("Hello Auth register")
	}
}

async function bootstrap() {
	const app: AnthraxFactory = new AnthraxFactory({
		controllers: [AuthController],
	})
	app.listen(4000, () => {
		console.log(`Server is running on port ${4000}`)
	})
}

bootstrap()