Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions api/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-misused-promises": "off"
}
}
16 changes: 16 additions & 0 deletions api/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import express, { type Express, type Request, type Response } from 'express'
import knex from 'knex'
import { Model } from 'objection'
import databaseConfig from './src/config/databaseConfig'
import cors from 'cors'
import userRouter from './src/routes/userRouter'

const app: Express = express()
const PORT: number = 8000
const knexInstance = knex({
client: 'postgresql',
connection: databaseConfig
})

Model.knex(knexInstance)

app.use(express.urlencoded({ extended: true }))
app.use(express.json())
app.use(cors())
app.use('', userRouter)

app.get('/', (req: Request, res: Response) => {
res.send('Hello world!')
Expand Down
47 changes: 47 additions & 0 deletions api/knexfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { Knex } from 'knex'
import databaseConfig from './src/config/databaseConfig'

// Update with your config settings.

const config: Record<string, Knex.Config> = {
development: {
client: 'postgresql',
connection: {
database: 'skyexplorer_apps',
user: 'muhammadbachtiar',
password: '123456',
port: 5000
}
},

staging: {
client: 'postgresql',
connection: {
database: 'my_db',
user: 'username',
password: 'password'
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},

production: {
client: 'pg',
connection: databaseConfig,
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
}

}

module.exports = config
Loading