Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bodysch-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
org
BodySCH
bodysch-backend
Commits
d8faebc7
Commit
d8faebc7
authored
5 years ago
by
Chif Gergő
Browse files
Options
Downloads
Patches
Plain Diff
Fix declaration errors
parent
5cff5e8e
No related branches found
No related tags found
2 merge requests
!10
Feature/12 dev auto deploy
,
!6
Feature/news api
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
nodemon.json
+1
-1
1 addition, 1 deletion
nodemon.json
src/index.ts
+33
-19
33 additions, 19 deletions
src/index.ts
tsconfig.json
+5
-5
5 additions, 5 deletions
tsconfig.json
with
39 additions
and
25 deletions
nodemon.json
+
1
−
1
View file @
d8faebc7
...
...
@@ -2,5 +2,5 @@
"watch"
:
[
"src"
],
"ext"
:
"ts"
,
"ignore"
:
[
"src/public"
],
"exec"
:
"ts-node src/index.ts"
"exec"
:
"ts-node
--files
src/index.ts"
}
This diff is collapsed.
Click to expand it.
src/index.ts
+
33
−
19
View file @
d8faebc7
import
"
./utils/env
"
import
"
./utils/env
"
;
import
express
,
{
Request
,
Response
,
NextFunction
,
Application
}
from
"
express
"
;
import
mongoose
from
"
mongoose
"
;
import
bodyParser
from
"
body-parser
"
;
import
expressSession
from
"
express-session
"
;
import
authRoute
from
'
./routes/auth
'
;
import
newsRoute
from
'
./routes/news
'
;
mongoose
.
connect
(
'
mongodb://localhost:27017/bodysch
'
,
{
useNewUrlParser
:
true
,
useCreateIndex
:
true
,
useUnifiedTopology
:
true
}
).
then
(
()
=>
{
console
.
log
(
"
Connected to database
"
)
},
).
catch
(
err
=>
{
console
.
log
(
"
MongoDB connection error. Please make sure MongoDB is running.
"
+
err
);
// process.exit();
});
import
authRoute
from
"
./routes/auth
"
;
import
newsRoute
from
"
./routes/news
"
;
mongoose
.
connect
(
"
mongodb://localhost:27017/bodysch
"
,
{
useNewUrlParser
:
true
,
useCreateIndex
:
true
,
useUnifiedTopology
:
true
})
.
then
(()
=>
{
console
.
log
(
"
Connected to database
"
);
})
.
catch
(
err
=>
{
console
.
log
(
"
MongoDB connection error. Please make sure MongoDB is running.
"
+
err
);
// process.exit();
});
const
app
:
Application
=
express
();
app
.
use
(
bodyParser
.
json
());
// for parsing application/json
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
// for parsing application/x-www-form-urlencoded
app
.
use
(
expressSession
({
secret
:
process
.
env
.
SESSION_SECRET
||
"
alma
"
,
resave
:
false
,
saveUninitialized
:
true
,
cookie
:
{
secure
:
false
}
}));
app
.
use
(
expressSession
({
secret
:
process
.
env
.
SESSION_SECRET
||
"
alma
"
,
resave
:
false
,
saveUninitialized
:
true
,
cookie
:
{
secure
:
false
}
})
);
app
.
use
((
req
:
Request
,
res
:
Response
,
next
:
NextFunction
)
=>
{
res
.
data
=
{};
next
();
});
app
.
get
(
"
/
"
,
(
req
:
Request
,
res
:
Response
)
=>
{
let
message
=
"
World!
"
;
if
(
req
.
session
!
.
user
)
message
=
req
.
session
!
.
user
!
.
sn
||
"
World!
"
;
res
.
send
(
"
Hello
"
+
message
)
if
(
req
.
session
!
.
user
)
message
=
req
.
session
!
.
user
!
.
sn
||
"
World!
"
;
res
.
send
(
"
Hello
"
+
message
);
});
// Register routes
...
...
This diff is collapsed.
Click to expand it.
tsconfig.json
+
5
−
5
View file @
d8faebc7
{
"files"
:
[
"./src/utils/declarations/response.d.ts"
,
"./src/utils/declarations/request.d.ts"
],
"compilerOptions"
:
{
"module"
:
"commonjs"
,
"strict"
:
true
,
...
...
@@ -15,9 +19,5 @@
"typeRoots"
:
[
"node_modules/@types"
]
},
"include"
:
[
"./src/**/*.ts"
],
"exclude"
:
[
"./src/public/"
],
"files"
:
[
"./src/utils/declarations/response.d.ts"
,
"./src/utils/declarations/request.d.ts"
]
"exclude"
:
[
"./src/public/"
]
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment