Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ungdev/ua-api
API web à destination des services de l'UTT Arena
https://github.com/ungdev/ua-api
express hacktoberfest prisma typescript utt-arena
Last synced: 11 days ago
JSON representation
API web à destination des services de l'UTT Arena
- Host: GitHub
- URL: https://github.com/ungdev/ua-api
- Owner: ungdev
- License: mit
- Created: 2020-05-04T15:13:14.000Z (over 4 years ago)
- Default Branch: dev
- Last Pushed: 2024-10-30T09:14:04.000Z (17 days ago)
- Last Synced: 2024-10-30T10:22:35.622Z (17 days ago)
- Topics: express, hacktoberfest, prisma, typescript, utt-arena
- Language: TypeScript
- Homepage:
- Size: 52.7 MB
- Stars: 7
- Watchers: 9
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UA-api
[![Build Status](https://github.com/ungdev/UA-api/actions/workflows/ci.yml/badge.svg)](https://github.com/ungdev/UA-api/actions)
[![codecov](https://codecov.io/gh/ungdev/UA-API/branch/master/graph/badge.svg)](https://codecov.io/gh/ungdev/UA-API)
[![Read the Docs](https://readthedocs.org/projects/ua/badge/?version=latest&style=flat)](https://ua.readthedocs.io/)API web à destination des services de l'UTT Arena
**Avant toute chose**, prenez connaissance de [la documentation](https://ua.readthedocs.io).
## Requirements
- [Node.js](https://nodejs.org/)
- [pnpm](https://pnpm.io/)## Installation
```
git clone [email protected]:ungdev/UA-api.git
# or
git clone https://github.com/ungdev/UA-api.gitcd UA-api
# Install all the dependencies
pnpm install# Copy the file .env.example to .env
cp .env.example .env
# Then, edit the variable DATABASE_URL in the file .env
```Then, connect to your database (MySQL/MariaDB) and enter
```
CREATE DATABASE arena CHARACTER SET utf8;
```Create the tables
```
pnpm prisma db push
```Populate the tables
```
mysql -u DATABASE_USER -p arena --protocol tcp < seed.sql
```Generate the prisma client (redo this command when you update schema.prisma)
```
pnpm prisma generate
```## Configuration
Edit the file .env with your values
## Commands
```
pnpm dev # start development server
pnpm build # builds the typescript to javascript
pnpm start # start production server
pnpm lint # checks if the code is correct
pnpm lint-fix # try to fix lint errors and warnings
pnpm fake # populate the database with fake data
pnpm schema:push # push the schema.prisma to the database
pnpm test:schema:push # push the schema.prisma to the test database (done automatically in tests)
```## Prisma config
Use `npx prisma generate` to generate your prisma client
## How to test
The tests must be able to run without any environment variables except the database
### Change the database for tests
Create a new `.env.test` file that will override values from `.env` :
```
cp .env.test.example .env.test
```Change the database name to `arena_test`. Change the credentials too, like in the `.env` file.
Open MySQL/MariaDB, and run the following command to create the database :
```
CREATE DATABASE arena_test CHARACTER SET utf8;
```What follows is mostly there for information purposes. It is done automatically during the tests. From what we know, there is no reason to use these commands.
Come back to your terminal :```
# Push the schema to the database :
pnpm test:schema:push# Seed the database :
mysql -u DATABASE_USER -p arena_test --protocol tcp < seed.sql
```### Run the tests
```
pnpm test
```# Documentation
We build the documentation with Sphinx based on markdown. If you want to compile the documentation on your local PC, you will need to have `Python 3` and then type the following commands:
```
cd docs
pip3 install -r requirements.txt
make html
```It will create a `build` folder where the doc is located