This API is designed for the Intro App Dev ID607001 Paper
To create an API and implement CRUD functionality and testing
This uses information from the video game Another Eden as the basis for my project.
Character information gathered from the wiki & In-game
- Clone the repository
- Run
npm install
to install all dependencies - Create a .env file in the root directory
- In the env use
PORT=3000
- Create a .env.development file in the root directory
- Create a .env.testing file in the root directory
- Run
npm run migrate
To migrate the db - Save if auto-save isn't turned on
Place the following inside
NODE_ENV=development
DATABASE_URL=file:./dev.db
Place the following inside
NODE_ENV=testing
DATABASE_URL=file:./test.db
npm run dev
Run in the dev environment
npm run prisma
Runs in prisma studio
npm run test
To run unit tests
npm run format
To run the prettier format
Can also use
npm run p:write
npm run p:check
to run the pretty-quick & prettier check commands
npm run dev
to Run the dev environment, for accessing API with postman
npm run test
To run all unit tests
npm run format
Will format code using prettier
Other options
npm run p:check
npm run p:write
localhost:3000/
localhost:[PORT] |
api/v1 | Endpoint |
---|---|---|
/api/v1/ | characters | |
/api/v1/ | attributes | |
/api/v1/ | rarities | |
/api/v1/ | affinities | |
/api/v1/ | elements | |
/api/v1/ | personalities |
/api/v1/characters
/api/v1/attributes
/api/v1/rarities
/api/v1/affinities
/api/v1/elements
/api/v1/personalities
/characters
"name": "Example name",
"affinity": "Light",
"description": "This is a character description"
/rarities
"rarity": 3,
"className": "Warrior",
"characterId": 1
/affinities
"bonus5": "SPD +5",
"bonus15": "PWR +10",
"bonus30": "INT + 3",
"bonus50": "END + 10",
"bonus75": "LCK + 40",
"bonus80": "Skill Slot +1",
"bonus105": "SPD + 20",
"bonus120": "PWR + 20",
"bonus140": "Grasta Slot +1",
"bonus175": "INT + 2",
"bonus200": "HP + 300",
"bonus215": "MP + 200",
"bonus225": "Badge Slot +1",
"bonus255": "All Stats +10"
/characters
{
"id": 6,
"name": "Abc",
"description": "Test",
"rarity": [],
"element": [],
"personality": [],
"affinity": "Light",
"affinityBonus": null,
"attributes": null
},
/rarities
{
"character":
{
"name": "Violet Lancer"
},
"rarity": 5,
"className": "Persephone",
"characterId": 5
}
/attributes
{
"character":
{
"name": "Violet Lancer"
},
"characterId": 5,
"hp": 4044,
"mp": 413,
"pwr": 286,
"int": 146,
"spd": 272,
"end": 214,
"spr": 178,
"lck": 205
}
- NodeJS
- Prisma
- Dotenv
- Joi
- Express
- Nodemon
- Commitizen
- Mocha
- Chai
- Prettier
Prisma documentation
Prisma relations
Chai documentation
Chai assertion
Mocha documentation
Lecture Notes
Markdown
Table of Contents Generator