Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HidayJS is open-source pure backend RESTful API template using ExpressJS based on clean MVC (Model View Controllers) architecture.

License

Notifications You must be signed in to change notification settings

hidayatur90/hidayjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HidayJS

About HidayJS

HidayJS is open-source pure backend RESTful API template using ExpressJS based on clean MVC (Model View Controllers) architecture.

Tech

This stack is still under development and possible to change at any time.

Installation

Dillinger requires Node.js to run. In this example below we want to use npm and npx, if you use yarn or others it doesn't matter just adjust it.

  1. Clone this Repository
git clone https://github.com/hidayatur90/hd-template
  1. Install the dependencies and devDependencies and start the server.
cd hd-template
npm i
  1. Rename .env.example to .env and update the file.
PORT=your_port
DB_NAME=your_database_name
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_HOST=your_database_host
DB_DIALECT=your_database_dialect
SECRET_KEY=your_secret_key_here

*adjust .env to what you will use

  1. Set your dialect

In this template the default dialect that use is MySQL, if you want to change it just install the library and adjust it. For example you want to use PostgreeSQL you can do...

npm install pg

and change DB_DIALECT on your .env file to your own dialect.

  1. Migrate the database and seed it using sequelize-cli
npx sequelize-cli db:migrate 
npx sequelize-cli seed:generate
  1. Finally, run the HidayJS
npm run dev

Default Auth

On this HidayJS template we use JWT auth, so if you want to try it make sure you must authenticate and set your token to the header.

header value
Content-Type application/json
authorization Bearer your_jwt_token

Improvement

HidayJS its just MVC template for ExpressJS so you can improve that with your requirement apps. For example you can improve with Swagger to make the Documentation API, you can change the default auth to OAuth, etc. You can use every sequelize-cli command like make models, seeder or migrate. For example you can use this command to make new models call Employee

npx sequelize-cli model:generate --name Employee --attributes fist_name:string,last_name:string

License

MIT License

About

HidayJS is open-source pure backend RESTful API template using ExpressJS based on clean MVC (Model View Controllers) architecture.

Topics

Resources

License

Stars

Watchers

Forks