Skip to content

Commit

Permalink
🚚 add router for api endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
thinktapper committed Nov 20, 2022
1 parent e9ad8ae commit a5fa8ca
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
35 changes: 35 additions & 0 deletions src/router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Router } from 'express'

const router = Router()

// HERD
router.get('/herd', () => {})
router.get('/herd/:id', () => {})
router.put('/herd/:id', () => {})
router.post('/herd', () => {})
router.delete('/herd/:id', () => {})

// FEAST
router.get('/feast', (req, res) => {
res.json({ message: 'Hungry?' })
})
router.get('/feast/:id', () => {})
router.put('/feast/:id', () => {})
router.post('/feast', () => {})
router.delete('/feast/:id', () => {})

// PLACE
router.get('/place', () => {})
router.get('/place/:id', () => {})
router.put('/place/:id', () => {})
router.post('/place', () => {})
router.delete('/place/:id', () => {})

// VOTE
router.get('/vote', () => {})
router.get('/vote/:id', () => {})
router.put('/vote/:id', () => {})
router.post('/vote', () => {})
router.delete('/vote/:id', () => {})

export default router
7 changes: 6 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import express from 'express'
import router from './router'

const app = express()

app.get('/', (req, res) => {
res.ok.json({ message: 'Hello World!' })
console.log('Hello from the server!')
res.ok
res.json({ message: 'Hello World!' })
})

app.use('/api', router)

export default app

0 comments on commit a5fa8ca

Please sign in to comment.