dashron / roads Goto Github PK
View Code? Open in Web Editor NEWAn isomophic web framework
License: MIT License
An isomophic web framework
License: MIT License
The node http server lowercases all header keys in the header object, but that's not necessarily true when we make api requests manually.
We should lowercase all header keys to standardize everything
Figure out a good way to handle sessions.
I don't like file system access, it needs to be in a database.
maybe redis.
If prod, hide errors. If dev, show.
public/private routes.
Handle within description
getRoute(uri_bundle, public_only)
processRoute(uri_bundle, success, failure, sub_route)
Possibly set up a third route type, "secure", which is https only?
Move away from public private routes and add support for uri_bundle.source.
The server should only ever check one array, so maybe there can be mappings in the router.
If no source mapping is found, load directly associated route list.
If a mapping is found, generate a list as defined in the mapping.
resource=main
server=server+main
Remove the uri component.
Add a 'pre-route' property or something similarly named.
On route, check initial resource.
If the initial resource does not have any matches, check the children.
When you check a child, check the pre-route first, if it matches check for routes just like you did on the initial resource.
If there is not a match, fail immediately and continue to the next child.
No issues noticed in production but it could use some serious load testing!
New standard pattern.
module.exports = new ({description});
so
module.exports = new Resource({
router : require('./example.routes'),
models : {
'user' : require('./models/user.model')
},
databases : {
'default' : new Database({
})
});
move unmatched route and route catchall into routes.
routes : {
public : [{}, {}],
private : [{}, {}],
default : {}
}
routes : require('stuff').
within require('stuff'), do module.exports = new Route({
});
Private routes are only accessed if that module is referenced directly. Private routes are never checked within a dependency.
onRequest : function (uri_bundle, view) {
// Investigate moving standard template into here. Maybe provide a wrapView function or something
}
We should allow renderers to be bound from within resource descriptions, instead of manually all around the place.
Initially it would be great just for the initial resource to load them all, and then if not already assigned sub-resources could load some.
In the future it would be great if the renderers were isolated, so that user and blog_post could each have different json renderers.
Static file resource supporting appropriate headers.
Websocket resources
tab indentation
one tab = 4 spaces
classes are ProperCaseNoSpace
methods are camelCase
variables are split_with_underscores
promises should all be promise.event(fn); promise._event();
It should validate using the model types.
we probably need additional information in the model types, strings and numbers should allow a max length, should allow a function to validate.
maybe
model.a = 1;
model.b = 'f';
if (model.isValid()) {
model.save();
}
should have one layer, what is allowed per user. not once for the user requirements then again for the db.
should never go to the db if validated properly.
should not save unless validated.
should allow other actions if valid - we already do that via ready, maybe thats good enough.
isValid should not be jammed into the models class, use a validator lib and jam all the type checks there
Add support for multiple files.
End goal is to reduce the amount of files that need to be updated when changing configuration options.
eg. a routes file, a models file, etc.
How to should describe how to install, how to run the example, how to run the tests and how to build your own site.
choose a framework, and start throwing up tests for the components.
resource.js line 159
I think it's for unmatched routes?
the url "/users/" was triggering it, when the route called for "/users"
I believe the values in the model must be incorrect, but this should probably never be allowed anyway. We might need to fix this in roads-models
It might be useful, at the very least it would be fun to set up
unload from require
unload from resource module cache
I believe that should ensure that future requests use the new resource, and current requests use the current one
write em
remove resource.build, and just use new Resource(config).
add unit tests
resource_module.get(name) simply returns the module at the name.
This allows extensions of the resource class
The catchall should just catch .js, and .css files.
Routing should act like /templates is the root directory.
so we need /templates/js, /templates/css which would route to /js/filename.js and /css/filename.css
Clean up the code, I have no idea how it works right now.
Implement into resource
Provide full unit testing
Build a front end framework for handling some javascript interaction.
eg.
Resource.get('user').request('123')
or...
gfw.update('#user_box', '/user/123/');
http://nodejs.org/api/domain.html
resource.request() will need to return a promise which can signal the absolute end of a request
view.render() will need to return a promise which can signal the absolute end of the render pipeline. This should call resource.request's promise.
docs
standards
unit tests
we need a way to identify that the view we are using is the root view. Sometimes we might not want to perform an action if it's not.
For example, a missing user within a sub view widget should probably not 404 the whole page, but that same url from a direct lookup should
Fall back to hard coded data if not connected to a database.
Comment on every last line of code to help people learn the system.
Should be kind of like preload, where it adds a modifier, but provides a simpler interface for a common task.
This one should take a function which is called once for each model, and if true is returned it will be in the final ready array.
user_request = UserModel.getAll();
user_request.filter(function (model) {
return model.name === "Aaron";
});
user_request.ready(function (models) {
// these will all be named aaron
});
write em
Ensure that the promise standards are supported, not just bluebird.
When a resource performs a route, it should strip the resources uri from the route and pass it to the router.
This should also happen when chaining through into child routes.
eg.
var zaft_resource = { uri : '/' , dependencies : ['user']};
var user_resource = { uri : 'user/' };
zaft_resource.route('/user/123');
//pull off the forward slash for the zaft_resource, so we are routing based on user/123
//check all children for a match
// if found
// pass into appropriate resource (in this case it's the user resource because 'user/123' is prefixed by the user_resources uri of 'user/'
// Go back to top, which will pull off 'user/', so we are simply routing based on the uri of '123'. This will not find any resources, so it goes to the routes and locates the route for /\d+/
// if not found, check all routes for a match
We might want this to be configurable, because it's a slightly odd logic flow.
The intent is to widen the use of common modules, by abstracting away the full uri.
Having a user module with the following routes would enable it to be used on a wider range of sites
/// : post = add, delete = remove
/\d+/ : get = read, put = update
/\d+/posts/ : get = read all posts, post = assign a post to a user
And then users can just change the uri config, and enable it across all sorts of sites.
resource_module.get(name) should just be an abstraction for require(resource_name).
It should not construct the resource, and handle it there, resource descriptions should follow the pattern of....
module.exports = new Resource({
//description
});
We currently have a way old version of mu hooked into the view renderer.
Update it to the newest version.
This probably already works, but I have not yet tried it myself. This issue is a reminder for the future.
First thoughts of course are file paths.
We should be able to identify the exact route that errored via extra data provided to error.
This could be shown to users logged in as administrators, or whatever the site creator deemed necessary.
Try to fit in as much data as possible
It would be nice to have some sort of "sub resource".
The idea is to fill the need of /user/5/posts
This resource should use the posts models, but have it's own routes. The routes could be /user/#, or whatever other prefix is taken.
This ticket should be tied into #1 somehow.
When #1 splits routes into their own file separate of the core description, it could receive a label of some sort, and the sub route chooses a different label of routes.
Maybe this could also be tied into #8, and the private label could handle that.
if true, this will kill any child elements and render immediately.
should be used with the appropriate status codes
should be used with static module
should tell child elements to ignore the render call (maybe set a new render status of CANCELLED)
should tell child element callbacks to stop doing stuff? maybe ignore render call is enough.
Add the ability for a route to exist, only be accessible through this.request(), and not via the browser.
Not sure if this should be done, it might add a bunch of cruft.
How to build a resource
How routes work
-this
-available functions
-the view hierarchy, and why it works
Changing view renderer
Adding render modes
move controller/model require into the resource definition and out of the resource object
Mu might not have all the features I want, Handlebars does.
Create a websocket component that works well with the existing structure.
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.