0.1.7 • Published 10 years ago

koa-smart-static v0.1.7

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

Middleware for Koa to serve a folder (and any subsequent subfolders/files) under a name declared by the user.

Syntax: app.use(serve(relativePath, nameToServeUnder))

Example

var serve = require("./"),
    koa = require('koa');
var app = koa();

app.use(serve('./example', 'test'));  // Path of folder, path you want to serve under.

app.use(function *(next) {
    if (this.path == '/') {
        this.body = "Try accessing '/test/1/test.html', '/test/2/test.txt', or '/test/3/test.json'";
    }
});

app.listen(3000);

See example.js for this code in action with some dummy data.

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago