Guides  ›  Routes  ›  Catchall ← PREV NEXT →

Catchall

Use * for requests without a matching route or static file.

// app/pages/not-found.js
module.exports = {
  paths: '*',
  methods: ['GET', 'POST'],
  handler: function (state) {
    state.res.statusCode = 404
    return 'Page not found'
  }
}

A catchall still follows its configured methods. Without a catchall, unmatched requests receive status 404.

Next: Query params →

Tools for business systems.