import { type Application } from "https://deno.land/x/opineHttpProxy@3.0.1/test/deps.ts";
Call Signatures
Opine instance itself is a request handler, which could be invoked without third argument.
Properties
The app.routes object houses all of the routes defined mapped by the associated HTTP verb. This object may be used for introspection capabilities, for example Opine uses this internally not only for routing but to provide default OPTIONS behaviour unless app.options() is used. Your application or framework may also remove routes by simply by removing them from this object.
Used to get all registered routes in Opine Application
The app.mountpath property contains one or more path patterns on which a sub-app was mounted.
Methods
Initialize the server.
- setup default configuration
- setup default middleware
- setup route reflection methods
Lazily adds the base router if it has not yet been added.
We cannot add the base router in the defaultConfiguration because it reads app settings which might be set after that has run.
Assign setting
to val
, or return setting
's value.
app.set('foo', 'bar'); app.get('foo'); // => "bar"
Mounted servers inherit their parent server's settings.
Return the app's absolute pathname based on the parent(s) that have mounted it.
For example if the application was mounted as "/admin", which itself was mounted as "/blog" then the return value would be "/blog/admin".
Check if setting
is enabled (truthy).
app.enabled('foo') // => false
app.enable('foo') app.enabled('foo') // => true
Check if setting
is disabled.
app.disabled('foo') // => true
app.enable('foo') app.disabled('foo') // => false
Listen for connections.
A Deno Server
is returned.
The mount event is fired on a sub-app, when it is mounted on a parent app. The parent app is passed to the callback function.
NOTE: Sub-apps will:
- Not inherit the value of settings that have a default value. You must set the value in the sub-app.
- Inherit the value of settings with no default value.
Emit an event using the applications event emitter.
Events will be raised based on the passed event string and any listening on() methods will receive the passed arg as an argument.
Register the given template engine callback fn
for the
provided extension ext
.
Render the given view name
name with options
and a callback accepting an error and the
rendered template string.
Example:
app.render('email', { name: 'Deno' }, function(err, html) { // ... })