Magenta Backend
This is the backend repository for magenta social media network
Getting Started
Install the dependencies
$ npm install
Create a .env file
$ cp .env.example .env
Set your .env
file and set your secret keys
JWT_SECRET_KEY=Your_Secret_Key
SESSION_SECRET_KEY=Your_Secret_Key
To start the app
$ npm run start:dev
Lint the project
$ npm run lint# fix$ npm run lint:fix
Code Style
This project code style uses Eslint + Airbnb + Prettier configuration
// .eslintrc.jsmodule.exports = {
extends: ['airbnb-base', 'plugin:prettier/recommended'],
plugins: ['prettier'],
Eslint rules
// .eslintrc.jsrules: { 'prefer-promise-reject-errors': 'off', 'no-underscore-dangle': 'off', 'func-names': 'off', 'no-console': 'off', 'import/no-dynamic-require': 'off',
},
Prettier Configurations
// .prettierrc{ "tabWidth": 2, "useTabs": false, "singleQuote": true}
Module Aliases
This project implements module aliases using the module-alias package to ease the usage of imports/requires
Existing aliases:
// package.json"_moduleAliases": { "@app": "./", "@config": "./config", "@middlewares": "./middlewares", "@models": "./models", "@httpd": "./httpd", "@services": "./services", "@validation": "./validation"
},
e.g
require('module-alias/register');const config = require('@config/express');
Packages And Tools