Overview of Pages

Pages turns a folder of files into a server-rendered website, inside PocketOne. It is built in as the pages extension (ext/pages): no npm package, no boot file, no build step.

Use Pages to create slim and modern web apps:

  • Start small and iterate
  • SEO-first principles
  • No build step
  • Fast server-side rendering

Hello world in just one file

<!-- pb_pages/index.ets -->
<%= `Hello, world!` %>
http://localhost:8090
Hello, world!

Inside <% and %> you write TypeScript; types are stripped, never checked, so plain JavaScript works too. Every page gets a ctx object with the request, the response, your data, and the app itself (ctx.app), so you can read and write records directly.

Retro file-based routing

Files become URLs, and +layout.ets files wrap the pages below them:

<!-- pb_pages/+layout.ets -->
<html>
  <body style="background-color: #b5dcb5">
    <%- slot() %>
  </body>
</html>
http://localhost:8090
Hello, world!

Coming from the npm package?

Pages is a clean API. Apps written for PocketPages 0.x (the npm package) don't run unchanged. See Moving from PocketPages 0.x.