Skip to content

xavier-ottolini/nestjs-typeorm

Repository files navigation

Test d'un serveur Node.JS avec le framework Nest.Js et l'ORM TypeOpm

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

This project test the Nest framework TypeScript using TypeOrm Object Relational Mapping.

Prerequisis

This project uses Docker

Installation and running in dev mode

$ docker compose -f docker-compose-dev.yaml up -d --build

Running the app in dev mode

$ docker compose -f docker-compose.yaml start

Stopping

$ docker compose -f docker-compose.yaml stop

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

API

Users

Lister les utilisateurs du forum

  • Method: GET
  • URL: http://localhost:3000/users

Récupérer un utilisateur du forum

  • Method: GET
  • URL: http://localhost:3000/users/{{id}}{{id}} est un nombre entier

Supprimer un utilisateur du forum

  • Method: DELETE
  • URL: http://localhost:3000/users/{{id}}{{id}} est un nombre entier

Ajouter un utilisateur au forum

  • Method: POST
  • Header: Content-type: application/json
  • URL http://localhost:3000/users
  • BODY:
{
  "firstname": "François",
  "lastname":"Laconique",
  "username":"francois.laconique",
  "email":"francois.laconique@veonum.com"
}

Modifier un utilisateur du forum

  • Method: PUT
  • URL: http://localhost:3000/users/{{id}}{{id}} est un nombre entier
  • Header: Content-type: application/json
  • BODY:
{
  "username":"francois.laconique2",
  "email":"francois.laconique2@veonum.com"
}

Keywords

Lister les mots clés

  • Method: GET
  • URL http://localhost:3000/keywords

Récupérer un mot clé

  • Method: GET
  • URL http://localhost:3000/keyword{{id}}{{id}} est un nombre entier

Créer un mot clé

  • Method: POST
  • Header: Content-type: application/json
  • URL http://localhost:3000/keyword
  • BODY
{
  "label": "Astronaute"
}

Modifier un mot clé

  • Method: PUT
  • Header: Content-type: application/json
  • URL http://localhost:3000/keyword/{{id}}{{id}} est un nombre entier
  • BODY
{
  "label": "Spacionaute"
}

Supprimer un mot clé

  • Method: DELETE
  • URL http://localhost:3000/keyword/{{id}}{{id}} est un nombre entier

Forum

Lister les sujets du forum

  • Method: GET
  • URL http://localhost:3000/forum

Récupérer un sujet du forum

  • Method: GET
  • URL: http://localhost:3000/forum/{{id}}

Supprimer un sujet du forum

  • Method: DELETE
  • URL http://localhost:3000/forum/{{id}}

Créer un sujet du forum

  • Method: POST
  • Header: Content-type: application/json
  • URL: http://localhost:3000/forum
  • BODY:
{
  "parent": null,
  "title": "premier sujet",
  "message": "salut à tous, j'ai un problème, je suis le premier homme sur la lune",
  "user": 1,
  "keywords": [{
      "id": 1,
    }, {
      "id": 2,
    }, {
      "id": 3,
    }]
}

Ajouter un sujet du forum en réponse à un autre sujet

  • Method: POST
  • Header: Content-type: application/json
  • URL: http://localhost:3000/forum
  • BODY:
{
  "parent": 1,
  "title": "Re: premier sujet",
  "message": "salut à toi! mais non, tu n'es pas tout seul ! moi aussi, je suis sur la lune !",
  "user": 2,
  "keywords": [{
      "id": 1,
      "label": "Satellite"
    }, {
      "id": 2,
      "label": "Astronaute"
    }, {
      "id": 4,
      "label": "Rencontre"
    }]

}

Modifier un sujet du forum

  • Method: PUT
  • URL: http://localhost:3000/forum/{{id}}
  • Header: Content-type: application/json
  • BODY:
{
  "title": "premier sujet modifié",
  "message": "salut à tous, j'ai un problème, je suis le premier homme sur mars."
}

Stay in touch

License

About

Test architecture Nest.Js with TypeOrm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published