Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Modify directory scanning such that directory paths dictate routes. #24

Merged
merged 2 commits into from
Mar 9, 2014

Conversation

totherik
Copy link
Member

@totherik totherik commented Mar 7, 2014

Previously, directory scanning merely loaded each file. Now when a directory is scanned, each directory and file is used in the creation of the route for a particular file. For example:

routes
 |-user
   |-create.js
   |-list.js 

will result in routes

/user/create
/user/list

while the implementation need only contain:

'use strict';
module.exports = function (router) {
    router.get('/', function (req, res) {
        res.send('ok');
    });
};

Additionally, this PR is a minor refactor with rewritten, cleaner tests.

@totherik totherik assigned jasisk and tlivings and unassigned jasisk and tlivings Mar 7, 2014
@grawk
Copy link
Member

grawk commented Mar 7, 2014

Looked at test changes and ran tests locally. From that perspective things look good to me. I don't fully understand all the new patterns, so there's the caveat with my thumbs up. But as the code clearly works and is tested ... 👍

tlivings added a commit that referenced this pull request Mar 9, 2014
Looks good. The documentation might be expanded upon.
@tlivings tlivings merged commit d0192f5 into master Mar 9, 2014
@totherik totherik deleted the smart-routes branch March 10, 2014 14:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants