LambdaMike / CSSPR-PUBLIC

System control and user management of the Attorney General's Office of the State of Paraná

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSSPR

image

Prerequisites

This project requires NodeJS (version 8 or later) and NPM.v Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
10.8.1
v20.13.1

Table of contents

Server

Installation

BEFORE YOU INSTALL: please read the prerequisites

Start with cloning this repo on your local machine:

$ git clone https://github.com/LambdaMike/CSSPR-PUBLIC.git
$ cd CSSPR-PUBLIC

To install and set up the library, run:

$ npm install

Generate database with prisma

$ npx prisma db push

Seed database with sample data:

$ npx ts-node prisma/seed.ts

Usage

Serving the server in development mode

$ npx nodemon server.ts

The server will be accessible at http://localhost:3001 (change port on server.ts)

API

API endpoints test

We recommend that you make http requests with Insomnia

import '/docs/api_Insomnia.json'

Check all API endpoints in '/routes/index.ts'

Options

Review some validation settings in 'middleware/validator.ts'

Example:

export const adminSchema = z.object({
    username: z.string().min(3, { message: "Username must be at least 3 characters long." }),
    password: z.string().min(3, { message: "Password must be at least 3 characters long" }), // Password implement .min(6) in production
    userId: z.number().optional(),
});

// OR
export const adminSchema = z.object({
    // ...
    password: z.string().min(6, { message: "Password must be at least 6 characters long" }), // Some regex validation...
    // ...
});

AUTH

Make sure to change the secret used in authentication /server.ts

// passport middleware
app.use(session({
  secret: "This is a secret",
  resave: false,
  saveUninitialized: false,
  cookie: {
    maxAge: 3600000 // 1 hour
  }
}));
initPassport(app);

Client

Credits

This is a fork of CSSPR

Built With

  • Node (Server)
  • Typescript (Server)
  • Prisma ORM (Server)
  • Vuejs (Client)
  • Love <3

Authors

License

MIT License © Victor Marques

About

System control and user management of the Attorney General's Office of the State of Paraná

License:MIT License


Languages

Language:Vue 51.8%Language:TypeScript 47.5%Language:HTML 0.3%Language:JavaScript 0.3%Language:SCSS 0.2%