A rudimentary event schedule service written in Typescript
Configured for deployment to AWS ECR with Docker Compose
WIP
The server is written in Typescript and uses Express for routing and Prisma for queries.
The database is a local sqlite db located in the db
folder.
The schema has three tables User, EventParticipant and Event.
Database migrations are handled by Prisma.
- node
- npm or yarn
- From the base directory run
yarn install
ornpm install
-
run
yarn start
ornpm run start
-
The server is available locally at port 3000
-
The client is available locally at port 8080
- run
yarn dev
ornpm run dev
Once you have the application running you will be access API documentation, test coverage reports and the API in the links provided in the following sections.
Pre-requisites:
- Docker
- Docker Compose
-
Run
docker compose build -d
-
Run
docker compose up -d
The server is available locally at port 3000 and the client at 80
- Run
docker compose down
- Don't forget to delete the image from ecr when you're done so you don't get charged for storage
aws ecr delete-repository --repository-name hello-repository --region region --force
- run
yarn test
ornpm run test
- Running this command will reseed the database with new data
The API is fully documented at /api-docs on localhost. The swagger documentation is generated from the OpenAPI 3.0
specification in the openapi.yaml
file. It should be possible to use the swagger UI to interact with the API.
Note the docs will not let you send in invalid requests so these must be done with curl or postman.
If you run into a cors issue you can import the yml file into a tool like Postman.
Ensure all date-times are encoded as ISO strings when sent to the server or they will be rejected. Example query strings will all be shown on the documentation page.
Code Coverage Report on localhost is available after running npm run test:coverage
Testing was performed with Jest and Supertest.
Global coverage is hovering around 90%
Tests are co-located in the folder structure with the files they are testing.
Validation was performed against the OpenAPI 3.0 schema using express middleware.
Some manual validation and error handling was necessary for dates and times.