Skip to content

ranggarifqi/employee-log-api

Repository files navigation

Employee Log API

The project is generated by LoopBack.

Description

How to Install

  1. It's recommended to Fork this repo first to your own github account.
  2. Clone the repo
https://github.com/[GITHUB_USERNAME]/employee-log-api.git
  1. cd employee-log-api
  2. npm i
  3. Create database manually on MySQL. Name of your choice

Environment Setup

Asumming that you're already inside the project root directory :

  1. cd server
  2. cp datasources.local.json.example datasources.local.json or copy paste it using Explorer
  3. vim datasources.local.json or nano datasources.local.json or Open it in Text Editor
  4. Edit it so the configuration will be like this, and change the value of [DB_NAME], etc WITHOUT the square brace [] :
{
  "db": {
    "name": "db",
    "connector": "memory"
  },
  "mysql": {
    "host": "127.0.0.1",
    "port": 3306,
    "url": "",
    "database": "[DB_NAME]",
    "password": "[DB_PASSWORD]",
    "name": "mysql",
    "user": "[DB_USER]",
    "connector": "mysql"
  }
}

Migration && Seeder Setup

Asumming that you're already inside root directory :

  1. cd server
  2. node create-mandatory-tables
  3. It will runs and show these :
Loopback tables 'Users' updated in mysql
Loopback tables 'RoleMapping' updated in mysql
Loopback tables 'AccessToken' updated in mysql
Loopback tables 'Role' updated in mysql
Loopback tables 'ACL' updated in mysql
  1. After you see above notification, Press Ctrl+C or Cmd+C to terminate. Because it will stuck
  2. node create-default-roles, and you will see
Role direktur created
Role manager created
Role pegawai created
  1. node create-default-users, and you will see
User [email protected] found / created
>> Role director assigned to user [email protected]
User [email protected] found / created
>> Role manager assigned to user [email protected]
User [email protected] found / created
>> Role pegawai assigned to user [email protected]

Running the Server

Asumming that you're already inside root directory :

  1. node .
  2. You will see this notification :
Loopback tables 'Journals' updated in mysql
  1. The server will be running at http://localhost:3000
  2. To open API Explorer, goto http://localhost:3000/explorer
  3. To use the API, use this URL http://localhost:3000/api/[MODEL]

About

API Server untuk aplikasi employee log

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published