Skip to content

Add channel controller and routes #25

@Iiquidate

Description

@Iiquidate

Create the first controller layer in the backend to expose channelModel
functions over HTTP. This establishes the controller/route pattern that
messages (and future resources) will follow, so structure decisions made here
will be reused.

Files to create:

  • apps/server/src/controllers/channelController.ts: HTTP handlers that call
    channelModel functions. No raw SQL.
  • apps/server/src/routes/channels.ts: wires verbs/paths/middleware to
    controller functions.
  • Register the router in apps/server/src/index.ts under /channels.

Endpoints:

  • GET /channels/official -> list official channels
  • GET /channels/nearby?lat=&lng= -> list nearby community channels (validate
    lat/lng are numbers)
  • GET /channels/:id -> fetch one channel, 404 if not found
  • POST /channels (requireAuth) -> create a community channel; createdBy comes
    from req.user
  • DELETE /channels/:id (requireAuth) -> delete a channel

Models already exist in
apps/server/src/models/channelModel.ts.

If you already started working on this don't worry too much about following the exact structure I outlined. Implement however you wish

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions