-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
60 lines (47 loc) · 1.11 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
. utils.sh
# Introduce
lightBlueln "=== Welcome to FCJ DNTU NodeJS Example ==="
println
# About
warnln "A. About"
println "This is a NodeJS Server is used to test in journey's labs or your own labs."
println "You can use to test your cloud infrastructure."
println
# Required packages
warnln "B. Required packages"
println " - NodeJS"
println " - ExpressJS"
darkGrayln "Note: you see these lines that means you're in the install process, so all of those packages will be installed"
println
# Endpoints
warnln "C. Endpoints"
println "Currently, this app supports these endpoints:"
infoln "GET - /users"
infoln "GET - /users/:id"
infoln "GET - /albums"
infoln "GET - /albums/:id"
println
# Check flag
hostNameFlag="--hostname"
portFlag="--port"
argsNumber=2
for arg in "$@"
do
IFS='=' read -r -a parts <<< "$arg"
flag="${parts[0]}"
value="${parts[1]}"
case $flag in
$hostNameFlag)
export HOST_NAME="$value"
;;
$portFlag)
export PORT="$value"
;;
*)
println "The flag $flag isn't supported"
;;
esac
done
infoln "Starting up application..."
pm2 start src/index.js