Coder Social home page Coder Social logo

t2ee / vader Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 4.0 383 KB

Koa Router in Typescript, Servlet-Like API

Home Page: http://vader.t2ee.org

License: Apache License 2.0

TypeScript 97.62% JavaScript 2.38%
typescript koa2 koa-router spring decorators nodejs t2ee

vader's People

Contributors

joesonw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vader's Issues

Make @t2ee/core a dependency.

I installed @t2ee/vader and built a tiny little app but it failed to launch because it has an unfulfilled dependency on @t2ee/core. This should not be a problem that I have to solve manually, vader should depend on core.

Add support (or documentation) for overloads by accept header.

It would be great if the following worked and the proper method was called based on what Accept header the caller supplied.

@Path('')
class Controller {
	@GET
	@Path('/getFruit')
	@Produces('application/json')
	async getFruitAsJson(): Promise<Response> {
		const repsonse = new Repsonse();
		response.body = { fruit: "apple" };
		return response;
	}
	@GET
	@Path('/getFruit')
	@Produces('text/plain')
	async getFruitAsString(): Promise<Response> {
		const repsonse = new Repsonse();
		response.body = "apple";
		return response;
	}

If this is currently supported and just undocumented, then consider this ticket a request for documentation.

v1.1 discussion thread.

  • Template View
  • Downloadable
  • Session
  • Identify Routes by @Consumes(Content-Type header) and @Produces(Accept header)

Unable to get any state into controller.

I have a controller that needs some persistent (across requests) state. I am unable to figure out how to attach some state to the controller using Vader.

I have tried following the "Custom Context Variables" at https://vader.t2ee.org/ as well as the @AutoWired from the t2ee core docs. In both cases, I get a variety of errors depending on which solution I try but none of them appear to actually work.

Is there currently any way to actually have some cross-request state other than a global variable (yuck)?

Examples don't work.

The examples don't include any of the necessary imports, so they don't work out of the box and due to the million ways to import something in TS/JS it is non-trivial to figure it out. The examples should work out of the box without the user having to go digging through source code to figure it out. This should include everything from installing the module, any necessary imports, setup, etc.

Router.use should return Router.

At the moment, Router.use returns void, which means it can't be chained. It would be nice to be able to chain setup of a bunch of middlewares/controllers:

const router = Router.newInstance
	.use(AuthMiddleware)
	.use(DdosProtectionMiddleware)
	.use(LoginController)
	.use(ShoppingCartController)
	.use(PetStoreController);

Generate autodocumentation for swagger

Hi @joesonw !
First of all thank you for your awesome work. I start adding autodocumentation for the module and this issue is to disscuss about your opinion.
You can check the first try i make here:
master...danibram:add_swagger_doc
Right now i only add the basics, with this code i can generate the swagger json and i autocreate a route to return the documentation in a json, remains the route to render this with official swagger module. Its only a first step.
Do you want to put inside your module?or in a external module? Maybe in the future i need to add a decorator for custom things like descriptions etc...

Also i add a test, to try it and works fine, maybe my code is bad im not a really expert with typescript classes.

I'm looking forward to hearing from you
Thanks for your time!

About documentation

Hi,
Your API is very good but I think is necessary documentation or examples.
I'm looking for know use MultiPart for file upload and How I can get context koa in my Controller.
Are There some examples for this?

Thank you

Cannot find name 'Symbol'.

PS D:\person\test\vad> tsc
node_modules/@t2ee/core/dist/injections/AutoWireMeta.d.ts(3,35): error TS2304: Cannot find name 'Symbol'.
node_modules/@t2ee/core/dist/injections/AutoWired.d.ts(3,44): error TS2304: Cannot find name 'Symbol'.
node_modules/@t2ee/core/dist/injections/Container.d.ts(10,68): error TS2304: Cannot find name 'Symbol'.
node_modules/@t2ee/core/dist/injections/Container.d.ts(11,34): error TS2304: Cannot find name 'Symbol'.
node_modules/@t2ee/core/dist/injections/Container.d.ts(13,38): error TS2304: Cannot find name 'Symbol'.
node_modules/@t2ee/core/dist/utils/Metadata.d.ts(8,34): error TS2304: Cannot find name 'Symbol'.
node_modules/@t2ee/core/dist/utils/Metadata.d.ts(9,34): error TS2304: Cannot find name 'Symbol'.
node_modules/@t2ee/vader/dist/handlers/ErrorHandler.d.ts(5,31): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.