1.0.7 • Published 3 years ago
create-anthrax-app v1.0.7
Anthrax, or AnthraxJS, is an easy and open-source framework written using Node.js. Anthrax allows for rapid prototyping code. Motivated by ExpressJS.
Installation
$ npx create-anthrax-app my-app
$ cd my-app
$ npm start
Hello Anthrax
import { AnthraxFactory, Methods } from "anthrax"
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()