Basic structure of the project

- Added a model with in-memory database, and routes, controller and
middleware to enable making initial CRUD calls to endpoints;

- Added jest and an initial test.
This commit is contained in:
Rodrigo Pinto 2025-04-02 16:34:16 -03:00
commit 9c4ea4ca90
11 changed files with 3841 additions and 1 deletions

View file

@ -1,11 +1,22 @@
import express from 'express'
import topicRoutes from './routes/topicRoutes'
import { errorHandler } from './middleware/errorHandler'
const app = express()
const port = 3000
app.use(express.json())
// Routes
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.use('/api/topics', topicRoutes);
// Global error handler (should be after routes)
app.use(errorHandler);
app.listen(port, () => {
return console.log(`Express is listening at http://localhost:${port}`)
})