init
此提交包含在:
9
src/config.ts
一般檔案
9
src/config.ts
一般檔案
@@ -0,0 +1,9 @@
|
||||
require('dotenv').config()
|
||||
const appConfig={
|
||||
port: process.env.NDH_PORT as any as number,
|
||||
dbHost: process.env.NDH_DB_HOST,
|
||||
dbUser: process.env.NDH_DB_USER,
|
||||
dbPassword: process.env.NDH_DB_PASSWORD,
|
||||
dbName: process.env.NDH_DB_NAME,
|
||||
}
|
||||
export {appConfig}
|
0
src/includes.ts
一般檔案
0
src/includes.ts
一般檔案
14
src/index.ts
一般檔案
14
src/index.ts
一般檔案
@@ -0,0 +1,14 @@
|
||||
import 'reflect-metadata'
|
||||
import express from 'express'
|
||||
import cors from 'cors'
|
||||
import {appConfig} from "./config"
|
||||
import {userRouter} from "./routers/user-router"
|
||||
const app=express()
|
||||
|
||||
app.use(cors())
|
||||
|
||||
app.use(userRouter)
|
||||
|
||||
app.listen(appConfig.port,() => {
|
||||
console.log('Server started at port '+appConfig.port)
|
||||
})
|
6
src/models/user-model.ts
一般檔案
6
src/models/user-model.ts
一般檔案
@@ -0,0 +1,6 @@
|
||||
import {Service} from "typedi"
|
||||
|
||||
@Service()
|
||||
class UserModel{
|
||||
|
||||
}
|
5
src/routers/user-router.ts
一般檔案
5
src/routers/user-router.ts
一般檔案
@@ -0,0 +1,5 @@
|
||||
import express from "express"
|
||||
|
||||
let userRouter=express.Router()
|
||||
|
||||
export {userRouter}
|
新增問題並參考
封鎖使用者