Add SQLite database to backend, interacting with the frontend

This commit is contained in:
2024-09-04 16:42:37 +02:00
parent 64f3769953
commit 955758ec4c
14 changed files with 1892 additions and 28 deletions

View File

@@ -1,7 +1,9 @@
import express from 'express'
import cors from 'cors'
import bodyParser from 'body-parser'
import { routes } from './routes/routes'
import { api } from './routes/api.routes'
import { categories } from './routes/categories.routes'
import { startDatabase } from './database'
const app = express()
const port = 3000
@@ -12,8 +14,12 @@ app.use(cors())
// Process JSON parameter
app.use(bodyParser.json())
// Use the app routes
routes(app)
// Create database and tables
startDatabase()
// Routes
app.use("/api", api)
app.use("/categories", categories)
// Start server
app.listen(port, () => {