A liver version of the open inventory system server can be found in https://open-inventory-system.herokuapp.com/
Install postgresql in the local machine and setup correctly. Then use following command to login to the psql
shell.
psql -U postgres
Then enter below commands in order to create the role from which the server will access the database.
CREATE ROLE openinventoryuser WITH LOGIN PASSWORD 'password';
CREATE DATABASE openinventorydatabase;
GRANT ALL PRIVILEGES ON DATABASE openinventorydatabase TO openinventoryuser;
\q
Then you should be able to login to psql
as openinventoryuser
.
psql -U openinventoryuser openinventoryuser
Install NodeJS. This program was tested with NodeJS 12.16.1 LTS.
On arch based systems,
sudo pacman -S nodejs-lts-erbium
sudo pacman -S npm
After that cd
to the project directory and run npm install
.
cd directory/project
npm install
Then create a .env
file in the project directory with following content.
You have to set the database user/password/secret as you wish.
PORT=8000
NODE_ENV=development
DATABASE_URL=postgres://smartlab:roJaGdNZgqNpLQcq@localhost:5432/smartlab
SALT_ROUNDS=10
JWT_SECRET=helloguys
LOG_LEVEL=info
[email protected]
[email protected]
ETHEREAL_PASSWORD=E6NyGYDJCgrCr9QKYN
[email protected]
GMAIL_PASSWORD=jHm33JhqdhWKuknB
SITE_API=http://localhost:3000/web-frontend/#
DB_INIT=false
[email protected]
SENDGRID_API_KEY=key
Then use nodemon
or node
to serve the pages.
npm run dev # to run using nodemon
npm start # otherwise
Now visit http://localhost:3000/ and confirm that site is running.
After initial run, set DB_INIT as false in the .env
file.