Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VILLASweb-backend-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASweb-backend-node
Commits
d79f1af1
Commit
d79f1af1
authored
8 years ago
by
Markus Grigull
Browse files
Options
Downloads
Patches
Plain Diff
Add support for development and production environment
parent
6478dde8
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+1
-1
1 addition, 1 deletion
Dockerfile
config.js
+20
-8
20 additions, 8 deletions
config.js
docker-compose.yml
+13
-12
13 additions, 12 deletions
docker-compose.yml
server.js
+5
-2
5 additions, 2 deletions
server.js
with
39 additions
and
23 deletions
Dockerfile
+
1
−
1
View file @
d79f1af1
...
...
@@ -7,5 +7,5 @@ COPY . .
RUN
npm
install
# Run the app
EXPOSE
3
000
EXPOSE
4
000
CMD
[ "npm", "start" ]
This diff is collapsed.
Click to expand it.
config.js
+
20
−
8
View file @
d79f1af1
...
...
@@ -20,12 +20,24 @@
******************************************************************************/
module
.
exports
=
{
databaseName
:
'
VILLAS
'
,
databaseURL
:
'
mongodb://localhost:27017/
'
,
port
:
4000
,
secret
:
'
longsecretislong
'
,
admin
:
{
username
:
'
admin
'
,
password
:
'
admin
'
development
:
{
databaseName
:
'
VILLAS
'
,
databaseURL
:
'
mongodb://localhost:27017/
'
,
port
:
4000
,
secret
:
'
longsecretislong
'
,
admin
:
{
username
:
'
admin
'
,
password
:
'
admin
'
}
},
production
:
{
databaseName
:
'
VILLAS
'
,
databaseURL
:
'
mongodb://database:27017/
'
,
port
:
4000
,
secret
:
'
longsecretislong
'
,
admin
:
{
username
:
'
admin
'
,
password
:
'
admin
'
}
}
}
}
;
This diff is collapsed.
Click to expand it.
docker-compose.yml
+
13
−
12
View file @
d79f1af1
node
:
image
:
villasweb-backend
ports
:
-
"
3000:3000"
links
:
-
mongo
environment
:
-
NODE_ENV=development
version
:
"
2"
mongo
:
image
:
mongo
ports
:
-
"
27017:27017"
services
:
backend
:
image
:
villasweb-backend
ports
:
-
"
4000:4000"
links
:
-
database
environment
:
-
NODE_ENV=production
database
:
image
:
mongo:latest
This diff is collapsed.
Click to expand it.
server.js
+
5
−
2
View file @
d79f1af1
...
...
@@ -27,8 +27,6 @@ var morgan = require('morgan');
var
cors
=
require
(
'
cors
'
);
// local include
var
config
=
require
(
'
./config
'
);
var
users
=
require
(
'
./routes/users
'
);
var
projects
=
require
(
'
./routes/projects
'
);
var
visualizations
=
require
(
'
./routes/visualizations
'
);
...
...
@@ -44,6 +42,9 @@ var User = require('./models/user');
// create application
var
app
=
express
();
// load configuration
var
config
=
require
(
'
./config
'
)[
app
.
get
(
'
env
'
)];
// configure app
app
.
use
(
bodyParser
.
json
());
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
...
...
@@ -74,6 +75,8 @@ app.use(function(req, res, next) {
});
// development error handler
console
.
log
(
"
Environment:
"
+
app
.
get
(
'
env
'
));
if
(
app
.
get
(
'
env
'
)
===
'
development
'
)
{
app
.
use
(
function
(
err
,
req
,
res
,
next
)
{
res
.
status
(
err
.
status
||
500
);
...
...
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