Created using ElydiaJS
Basic project creating a backend of a Todo app, based of the same project EpyTodo using ExpressJS who is a outdated version
The database is managed with TypeORM an ORM tool in TypeScript the models are in /src/entity/
.
The connection creditals are avaiable in the docker-compose.yml
and src/data-source.ts
.
The database identifiers are managed on the environnement
x-environment: &environment
POSTGRES_USER: elysia
POSTGRES_PASSWORD: elysia
POSTGRES_DB: elysia-todo
The backend app uses the AppDataSource
config to setup the tables and the database identifiers
export const AppDataSource = new DataSource({
type: "postgres",
host: "localhost",
port: 5435,
username: "elysia", // POSTGRES_USER
password: "elysia", // POSTGRES_PASSWORD
database: "elysia-todo", // POSTGRES_DB
synchronize: true,
logging: true,
entities: [User, Todo], // The database tables to init
subscribers: [],
migrations: [],
})
To start the database we need to run the docker-compose.yml
file
sudo docker compose -f docker-compose.yml up --build --force-recreate
npm run dev