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
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
$ npx nodemon server.ts
The server will be accessible at http://localhost:3001 (change port on server.ts)
We recommend that you make http requests with Insomnia
import '/docs/api_Insomnia.json'
Check all API endpoints in '/routes/index.ts'
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...
// ...
});
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);
-
Check Client README
This is a fork of CSSPR
- Node (Server)
- Typescript (Server)
- Prisma ORM (Server)
- Vuejs (Client)
- Love <3
-
Rhian Felipe - Original work/project - RhianFelipe
-
Victor Marques - Currently developer - LambdaMike
MIT License © Victor Marques