The path with parameters.
The new path validator.
https://github.com/lukeed/regexparam
import assert from 'assert'
import createServer, { IHttpRequest, IHttpResponse, params } from '@egomobile/http-server'
const app = createServer()
app.get(params('/dirs/:dir/files/:file'), async (request: IHttpRequest, response: IHttpResponse) => {
assert.strictEqual(typeof request.params!.dir, 'string')
assert.strictEqual(typeof request.params!.file, 'string')
})
await app.listen()
Generated using TypeDoc
Creates a new path validator that extracts parameters from the path and writes the data to 'params' property of request context as key/value pairs.