Los Angeles v0.3

Page Server Options

When creating a Los Angeles page server, you pass it an "options" object that controls certain aspects of its behaviour:

// Serve Los Angeles .page files
app.use(la.serve({
    contentPath: publicRoot
}).middleware)

The following describes these options.

contentPath Property

The contentPath property specifies the base directory from which .page files should be loaded.

This property is required.

cache Property

This optional boolean property controls whether loaded .page files are cached.

If not specified, caching is enabled in production environments and disabled in development environments.

To clear the cache, use the clearCache() method of the returned page server object:

// Create page server
var pageServer = la.server({ 
    contentPath: path.join(__dirname, 'public'),
    cache: true,
})

// Install middleware
app.use(pageServer.middleware)

.
.
.

// Somewhere else, perhaps on a scheduled task, clear the cache:
pageServer.clearCache();

cacheMaxPages property

Sets the maximum number of pages to be cached. Least recently used pages are removed first. If not specified, the default value of this property is 50.