μlbs Examples

Explore practical examples of μlbs in action for common project patterns and integrations.

💡 View Examples

Why μlbs Examples Matter

These examples demonstrate real-world usage of μlbs for microservices architecture. Each example includes complete, working code that you can integrate directly into your projects.

Featured Examples

Basic Server Setup

import mulbs from 'mulbs'

const app = mulbs.createApp()

app.get('/', (req, res) => {
  res.send('Hello from μlbs!')
})

app.listen(3000, () => {
  console.log('Server running on port 3000')
})

Route Handling

const router = mulbs.Router()

router.get('/users', async (req, res) => {
  const users = await fetchUsers()
  res.json(users)
})

app.use('/api', router)

Middleware Integration

app.use((req, res, next) => {
  console.log(`Request received: ${req.method} ${req.url}`)
  next()
})

Error Handling

app.use((err, req, res, next) => {
  console.error(err.stack)
  res.status(500).send('Something broke!')
})

Docker Deployment

FROM node:18
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]

CLI Command

$ npx create-mulbs@latest my-project
$ cd my-project
$ npm run dev

Try It Yourself

Clone the μlbs examples repository to see these in action with a working project structure.