t2ee / vader Goto Github PK
View Code? Open in Web Editor NEWKoa Router in Typescript, Servlet-Like API
Home Page: http://vader.t2ee.org
License: Apache License 2.0
Koa Router in Typescript, Servlet-Like API
Home Page: http://vader.t2ee.org
License: Apache License 2.0
The example in the readme just returns 404 when I try to navigate to /say
.
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.
Installed the recommended dependencies from the readme and tried to setup a simple router class. I get this error. I have installed reflect-metadata
.
Specify all untyped places with any
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!
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);
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.
@Consumes
(Content-Type
header) and @Produces
(Accept
header)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)?
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.
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.
Hello!
I don't understand how can I use this module. Can you help me ?
@Path('/')
class Controller {
@Path('/route')
route() {}
}
will not work, because of two '/'s.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.