Coder Social home page Coder Social logo

roads's People

Contributors

dashron avatar dependabot[bot] avatar

Stargazers

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

Watchers

 avatar  avatar

roads's Issues

Standardize request header character case

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

Session Handler

Figure out a good way to handle sessions.
I don't like file system access, it needs to be in a database.
maybe redis.

Improve router

public/private routes.
Handle within description

getRoute(uri_bundle, public_only)
processRoute(uri_bundle, success, failure, sub_route)

Https support

Possibly set up a third route type, "secure", which is https only?

Add source support to router

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

Tweak Routing

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.

Clean up resource description

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
}

Allow view renderers to be defined from the resource description

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.

Clean up code to follow standards

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();

Add Model Validation

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

Improve resource descriptions (config)

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.

Unit Testing

choose a framework, and start throwing up tests for the components.

live reloading of resources

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

Clean resource component

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

Improve Static Module Routes

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

Front end framework

Build a front end framework for handling some javascript interaction.

eg.
Resource.get('user').request('123')

or...
gfw.update('#user_box', '/user/123/');

Add domains to server.js

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.

handle status codes within subviews appropriately

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

Built in filter modifier on ModelRequest

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
});

Improve Router/Resource interaction

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.

Change resource description to work like models

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
});

Update to use mu 0.5

We currently have a way old version of mu hooked into the view renderer.
Update it to the newest version.

Windows Support

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.

Provide extra data to view::error()

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

Sub Resources

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.

add force flag to render: render(template, force)

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.

Private routes

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.

Start writing user facing documentation

How to build a resource

How routes work
-this
-available functions
-the view hierarchy, and why it works


Advanced

Changing view renderer
Adding render modes

resource

move controller/model require into the resource definition and out of the resource object

Websocket Component

Create a websocket component that works well with the existing structure.

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.