web-decorators's Issues
Child controllers
Find something to "mount" other controllers to a current controller, so the app would be a tree of Controller linking each other.
A PropertyDecorator might be used for that purpose.
Create response object
Set response cookies
- Add cookie attribute in ResponseMetadata
- Make the express adapter to send the cookies
Handle errors for async results
- Use next if a thunk returns an error
- Use next if a promise returns an error
Read request cookies
Refactor parameter decorators
Better return type detection
Use bluebird's when to detect a promise
Error handlers
Add error handler in controllers ?
Maybe something like spring's controller advice ?
use typescript 1.5 beta instead of alpha
Read request headers
Create helpers to create specific responses metadata
- send a file
- send a file as an attachement
- do a permenant / temporary redirection
- Access denied
- Not authorized
- 500 Error
...
Make sure it works with inheritance
Create a default adapter without express
Use https://www.npmjs.com/package/route-parser for route matching, implement the concept of routes and middlewares.
- Create the main handler function to give to http#createServer()
- Create the structure that takes the methods and patterns
- Create the api to add routes to the route container
- On request, dispatch the request to the right handler, from the pattern and method
- Extract path params from the request
- Extract query string params from the request
- Provide an API to read the request body
- Add response related tasks
- Add middleware related tasks
Response type handling
For the moment, the result is sent as is, it should be possible to force a return type.
Publish on npm
How to provide the typing information through an npm package ?
- Create .npmignore file
- Create a dist .d.ts type definition file
- Normalize the public interface
- Add express adapter in the public interface
Set reponse headers
Status code
Change how a controller is bootstrapped
A controller is bootstrapped (configured with the backend) when it is first encountered by the runtime.
It would be better if the @controller decorator did not contain the backend adapter, and use directly the adapter to add classes that must be parsed.
Moreover, with es6 or commonjs modules, all classes are not loaded at startup, so only adding a @controller alone would not have much effect.
@controller might be merged with @route.
cool stuff !!
Nice work, Cy ๐
Return value
We must inject the response with @ResParam to send content to the client, it would be better to return a result with a return statement, even an asynchronous result via Promise or thunk.
Unit tests for request handler parameter
Request handler parameters are not well unit tested
More integration for middlewares
Middlewares are not as integrated into the API as normal routes, for example, parameters are not injected.
Make return type decorators compatible with class ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.