Skip to content

First App (2min)

  1. Install Oweb via npm:
Terminal window
npm install owebjs
  1. Start with a minimal app, then we will add route conventions step by step.
import Oweb from 'owebjs';
const app = await new Oweb({ uWebSocketsEnabled: true }).setup();
await app.loadRoutes({
directory: 'routes',
hmr: {
enabled: true,
},
});
const { err, address } = await app.start({ port: 3000, host: '127.0.0.1' });
if (err) throw err;
console.log(`Server running at ${address}`);

What this does:

  • Creates an Oweb app instance (here in uWebSockets mode)
  • Loads your route files from routes/
  • Enables HMR for development
  • Starts the HTTP server