Skip to content

Commit 0fadff9

Browse files
committed
Merge branch 'starter-kit'
# Conflicts: # README.md # package.json
2 parents 2e923cb + 66a99d8 commit 0fadff9

File tree

3 files changed

+73
-6
lines changed

3 files changed

+73
-6
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,42 @@ clone this repo and start your project
66
## Installation
77

88
```bash
9-
npx @gulali/nodejs-express-sequelize-mysql-api-boilerplate my-project-name
9+
npx @gulali/nodejs-express-sequelize-mysql-api-boilerplate my-project-api
1010
```
1111

1212
## Usage
1313

14+
### Database configuration
15+
16+
edit config/config.json file and change your database name, username and password
17+
18+
```bash
19+
{
20+
"development": {
21+
"username": "root",
22+
"password": "",
23+
"database": "api_db_development",
24+
"host": "127.0.0.1",
25+
"dialect": "mysql"
26+
},
27+
"test": {
28+
"username": "root",
29+
"password": "",
30+
"database": "api_db_test",
31+
"host": "127.0.0.1",
32+
"dialect": "mysql"
33+
},
34+
"production": {
35+
"username": "root",
36+
"password": "",
37+
"database": "api_db_production",
38+
"host": "127.0.0.1",
39+
"dialect": "mysql"
40+
}
41+
}
42+
43+
```
44+
1445
```bash
1546
npm run start:dev
1647
```

bin/cli.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env node
2+
const { execSync } = require('child_process');
3+
4+
const runCommand = command => {
5+
try {
6+
execSync(`${command}`, { stdio: 'inherit' });
7+
} catch (e) {
8+
console.error('Failed to execute ${command}', e);
9+
return false;
10+
}
11+
return true;
12+
};
13+
14+
const repoName = process.argv[2];
15+
const gitCheckoutCommand = `git clone --depth 1 https://github.com/gulalicelik/nodejs-express-sequelize-mysql-api-boilerplate.git ${repoName}`;
16+
const installDepsCommand = `cd ${repoName} && npm install`;
17+
18+
console.log(`Cloning the repository with name ${repoName}`);
19+
const checkedOut = runCommand(gitCheckoutCommand);
20+
if (!checkedOut) process.exit(-1);
21+
22+
console.log(`Installing dependencies for ${repoName}`);
23+
const installedDeps = runCommand(installDepsCommand);
24+
if (!installedDeps) process.exit(-1);
25+
26+
27+
console.log(
28+
'Congratulations! You are ready. Follow the following commands to start'
29+
);
30+
console.log(`cd ${repoName} && npm start:dev`);

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
{
2-
"name": "nodejs-express-sequelize-mysql-api-boilerplate",
3-
"version": "1.0.2",
4-
"description": "",
2+
"name": "@gulali/nodejs-express-sequelize-mysql-api-boilerplate",
3+
"version": "1.0.4",
4+
"description": "Nodejs Express Sequelize Mysql API Boilerplate with JWT, Swagger, Winston, PM2",
55
"main": "index.js",
6+
"publishConfig": {
7+
"access": "public"
8+
},
69
"scripts": {
710
"prepare": "npx sequelize-cli db:create && npx sequelize-cli db:migrate",
811
"start:dev": "pm2 start --env dev",
912
"start:test": "pm2 start --env test",
1013
"start:prod": "pm2 start --env prod",
1114
"test": "echo \"Error: no test specified\" && exit 1"
1215
},
16+
"bin" : {
17+
"create-nodejs-express-sequelize-mysql-api-boilerplate" : "./bin/cli.js"
18+
},
1319
"repository": {
1420
"type": "git",
1521
"url": "git+https://github.com/gulalicelik/nodejs-express-sequelize-mysql-api-boilerplate.git"
1622
},
17-
"keywords": [],
18-
"author": "",
23+
"keywords": ["api", "boilerplate", "nodejs", "express", "sequelize", "mysql", "jwt", "swagger", "winston", "pm2","api-boilerplate","nodejs-api", "nodejs-sequelize-api"],
24+
"author": "Gülali Çelik",
1925
"license": "ISC",
2026
"bugs": {
2127
"url": "https://github.com/gulalicelik/nodejs-express-sequelize-mysql-api-boilerplate/issues"

0 commit comments

Comments
 (0)