nx-extensions icon indicating copy to clipboard operation
nx-extensions copied to clipboard

Nxextjs - Backend framework designed for adapters and extension.

Open Jordan-Hall opened this issue 3 years ago • 1 comments

This is so people can see the plans. This is a concept for a new backend framework thats designed to be extendable with adaptors.

SUDO CODE:

import { denoConnect } from '../src/packages/http/deno/deno.connect.ts';
import { LibertyServerRouter, LibertyServer } from '../src/framework/mod.ts';

const app = new LibertyServer({
    http: denoConnect, // expressConnect, Fastily, nodeConnect
    router: new LibertyServerRouter([
        {
            path: '/name/:name',
            httpMethod: "Get",
            method: () => {}
        }
    ]),
    middleware: {
			before: [],
			after: []
		},
		IOC: {
			bind: [{ type: 'service', value: ServiceClass, mode: mode.Singleton }],
			container: Inversify
		}
});
app.addRoute('/settings', (req, res) => {
	res.send('Hello World!');
})
app.addController(HomeController);
app.bind<Warrior>(TYPES.Warrior).to(Ninja).inSingletonScope();
app.bind<Warrior>(TYPES.Warrior).to(Ninja).inTransientScope();
app.bind<Warrior>(TYPES.Warrior).to(Ninja).inRequestScope();
console.log(app.listen());


bootstrap(expressConnecct, app => {
	app.addRoute('/settings', (req, res) => {
		res.send('Hello World!');
	})
	app.addController(HomeController);
	app.bind<Warrior>(TYPES.Warrior).to(Ninja).inSingletonScope();
	app.bind<Warrior>(TYPES.Warrior).to(Ninja).inTransientScope();
	app.bind<Warrior>(TYPES.Warrior).to(Ninja).inRequestScope();
	app.port(3000)
	return app;
})


@Controller("/account")
export class AccountController {

  constructor(private service: AuthService) {}

  @Get("/login")
  getLogin(@Ctx() context: SecurityContext) {
    if (context.security.auth.identity()) {
      return Redirect("/protected");
    }
		return  401()
  }
}

@Injectable({
	mode: 'RequestScope',
})
export class AuthService {
	constructor(
		@Container() ioc: IOCContainer) {
		this logger = ioc.get<type>('Logger');

	}
}

Jordan-Hall avatar Feb 13 '22 19:02 Jordan-Hall

☁️ Nx Cloud Report

CI ran the following commands for commit a2486033f2d85cc0aea75f0804c101cd488c0b9d. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx affected:build --base=origin/main --head=HEAD

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Feb 13 '22 19:02 nx-cloud[bot]