pixelrest v1.0.0
Pixelrest
Make API REST on node.js
Get started
Install pixelrest with npm :
npm install --save pixelrest
Generate a project pixelrest :
pixelrest-new
Set your node projet in ES module mode, add following property to your package.json file :
"type": "module"
You should make a mysql/mariadb database(InnoDB)
Create file secret.js in app/config
with your mysql server and database credentials.
Secret.js file example:
export const DB_CREDENTIALS = {
DATABASE: 'mydatabase',
HOST: 'localhost',
PORT: 3306,
USERNAME: 'root',
PASSWORD: 'password'
};
export const JWT = {
SECRET: 'mysecret',
EXPIRES_IN: 14400
};
Prepare your database with the script prepareDatabase :
node ./app/scripts/prepareDatabase.js
Start your server :
nodemon ./main.js
Test your API REST with swagger :
http://localhost:1338/api-docs
Before testing documents service, don't forget to create documents directory in your projet
SECURITY
Never push secret.js on your git. You should add it to your gitignore!