Skip to content

Instantly share code, notes, and snippets.

@imlana21
Last active November 3, 2021 04:17
Show Gist options
  • Save imlana21/383bd9c21cf479e36da35dcea5eb50d2 to your computer and use it in GitHub Desktop.
Save imlana21/383bd9c21cf479e36da35dcea5eb50d2 to your computer and use it in GitHub Desktop.
Next Fullstack Configuration
DB_CLIENT=mysql
DB_PORT=3306
DB_HOST=127.0.0.1
DB_NAME=nextfullstack
DB_USER=
DB_PASS=
BASE_URL=http://localhost:3000/
const db = require('knex')({
client: process.env.DB_CLIENT,
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
},
});
export default db;
const dotenv = require('dotenv');
dotenv.config({ path: '.env.local'});
module.exports = {
development: {
client: process.env.DB_CLIENT,
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
},
migrations: {
directory: './database/migrations'
},
seeds: {
directory: './database/seeds'
}
},
staging: {
client: process.env.DB_CLIENT,
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
},
pool: {
min: 2,
max: 10,
},
migrations: {
directory: './database/migrations'
},
seeds: {
directory: './database/seeds'
}
},
production: {
client: process.env.DB_CLIENT,
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME,
},
pool: {
min: 2,
max: 10,
},
migrations: {
directory: './database/migrations'
},
seeds: {
directory: './database/seeds'
}
},
};
-> project_name
   |-> component    // Berisi React Component
   |-> database     // Berisi file yang berhubungan langsung dengan database
        |-> migrations  // Database Migrations
        |-> seeds       // Database Seeder
        |-> db.js       // File Konfigurasi Database
   |-> layouts      // Berisi Layouts Page
   |-> middleware   // Jembatan penghubung
   |-> pages        // Halaman yang ditampilkan ke user. Routing berdasarkan struktur folder
   |-> public       // File yang berada disini akan ditampilkan secara public
   |-> styles       // Berisi style halaman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment