Skip to content

Repository files navigation

code style: prettier

ts

Prisma

Simple Chart

Running locally

To start the application in dev mode, please run:

git clone https://github.com/tobslob/sleep-duration-tracker-server.git
 cd sleep-duration-tracker-server
 yarn install
 add `.env` to root folder, copy the .env.example

Running using postgres on docker

ensure you have docker installed and running

To ensure port 5432 is free.

sudo lsof -i:5432
sudo kill -15 <pid>

Install PostgreSQL on local machine using the following command:

docker pull postgres

run the postgres image

docker run -d --name dev-postgres \
 --restart=always \
 -e POSTGRES_PASSWORD=secret123 \
 -e POSTGRES_USER=postgres \
 -e POSTGRES_DB=simple-chart \
 -p 5432:5432 postgres

check that the container is running

docker ps
npx prisma migrate dev --name init
yarn seed:db
yarn watch
yarn start:dev

Application is ready to receive connection @ http://localhost:8080

API-ENDPOINTS

USER ENTRIES

- POST /api/v1/users Create user entry

curl -X POST -H "Content-Type: application/json" \
-d '{
  "emailAddress": "kazeem.o.odutola@gmail.com",
  "name": "Kazeem Odutola",
  "gender": "male",
  "sleepTimeDuration": 2,
  "date": "26-07-26"
}' http://localhost:8080/api/v1/users

- GET /api/v1/users Get a user entry

curl -X GET "http://localhost:8080/api/v1/users?emailAddress=kazeem.o.odutola@gmail.com"

- GET /api/v1/users Get users entry count

curl -X GET "http://localhost:8080/api/v1/users"

Alt text

TODO

  • Add more unit testing to ensure functions work accordingly
  • Add pagination from the backend, though pagination is been done from the frontend currently.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages