Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
Homework_89_Tsoy_Danil
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Цой Данил
Homework_89_Tsoy_Danil
Commits
bfe15b20
Commit
bfe15b20
authored
Mar 14, 2023
by
Цой Данил
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1
added index.ts + checkhealth
parent
eb4569a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
healthCheck.ts
src/controllers/healthCheck.ts
+18
-0
index.ts
src/index.ts
+17
-1
No files found.
src/controllers/healthCheck.ts
0 → 100644
View file @
bfe15b20
import
express
,
{
Router
,
Request
,
Response
}
from
'express'
export
class
HealthCheckController
{
private
router
:
Router
constructor
()
{
this
.
router
=
express
.
Router
()
this
.
router
.
get
(
'/'
,
this
.
checkHealth
)
}
public
getRouter
=
():
Router
=>
{
return
this
.
router
}
private
checkHealth
=
(
req
:
Request
,
res
:
Response
):
void
=>
{
res
.
send
(
'Server is OK'
)
}
}
src/index.ts
View file @
bfe15b20
import
express
,
{
Express
}
from
"express"
;
import
express
,
{
Express
}
from
"express"
;
import
dotenv
from
'dotenv'
;
import
dotenv
from
'dotenv'
;
import
cors
from
'cors'
;
import
cors
from
'cors'
;
import
{
HealthCheckController
}
from
"./controllers/healthCheck"
;
dotenv
.
config
()
dotenv
.
config
()
...
@@ -12,4 +13,19 @@ class App {
...
@@ -12,4 +13,19 @@ class App {
this
.
app
.
use
(
express
.
static
(
'public'
))
this
.
app
.
use
(
express
.
static
(
'public'
))
this
.
app
.
use
(
cors
())
this
.
app
.
use
(
cors
())
}
}
}
\ No newline at end of file
public
init
=
async
():
Promise
<
void
>
=>
{
try
{
this
.
app
.
use
(
'/health-check'
,
new
HealthCheckController
().
getRouter
())
this
.
app
.
listen
(
process
.
env
.
APP_PORT
,
()
=>
{
console
.
log
(
`Server is running on port
${
process
.
env
.
APP_PORT
}
`
)
})
}
catch
(
err
:
unknown
){
console
.
log
(
err
);
}
}
}
const
app
=
new
App
();
app
.
init
();
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment