ProjectMark-Rodrigo/src/app.ts
Rodrigo Pinto 9c4ea4ca90 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.
2025-04-02 17:07:06 -03:00

22 lines
483 B
TypeScript

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}`)
})