Skip to content

EmmanuelLefevre/ArtiWave

Repository files navigation

ArtiWave

INTRODUCTION

ArtiWave is a back-end blogging application developped with Express. It uses MongoDB as well as the Mongoose ORM. It has JWT authentication and allows you to perform CRUD operations on articles depending on your role.

INSTALLATION

1. Local

Database

mongosh
use artiwave
db.createCollection("users")
db.createCollection("articles")

MongoDb create a database documentation

  • Create an authentication
mongosh
use artiwave
db.createUser({ user: "Admin", pwd: "nimda", roles: [{ role: "readWrite", db: "artiwave" }] })

MongoDb create a user documentation

  • Connexion to database
1. Connexion with Mongosh:
db.auth("Admin","nimda")
2. Or connexion with MongoDb VsCode extension:

Connexion MongoDb VsCode extension step 1
Connexion MongoDb VsCode extension step 2


Clone and install project

git clone
nvm install 20.10.0
npm install

Generate keys for JWT

cd api
mkdircd _certs
openssl genrsa -out pvt.pem 4096
openssl rsa -in pvt.pem -outform PEM -pubout -out pbl.pem

Check private key

openssl rsa -check -in _certs/pvt.pem

Load fixtures

make lf

Launch server

If NVM is locally installed on your computer and you're not confident that you're on the required Node v20.10.0 LTS you could execute this command line =>

nvm use 20.10.0

Or check your version with =>

node -v

Then you could launch server with makefile =>

make dev

Otherwise with NPM

npm run dev

Swagger doc

localhost:9001/api/swagger-doc

Launch tests

npm run test

Launch tests coverage

npm run test:cov

SONARQUBE ANALYSIS

1. First give rights to the sonar-server.sh file:
chmod u+x sonar-server.sh
2. Start the server after opening docker desktop:
./sonar-server.sh
3. Open a browser and open the URL => http://localhost:9000
4. Enter credentials Login: admin and Password: admin
5. Set a new password...

SonarQube update password

6. Create new project manually

ProjectKey = ArtiWave

7. Generate a token

SonarQube generate token

8. Get the token

SonarQube get token

9. Provide the token in ArtiWave project

Replace token by the created one in scan.sh file ArtiWave provide token

10. Give rights to the scan.sh file
chmod u+x scan.sh
11. Launch SonarQube tests
./scan.sh

About

📰 Article management application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published