diff --git a/index.js b/index.js index 06e8033..c593cf3 100644 --- a/index.js +++ b/index.js @@ -85,4 +85,7 @@ server.get('/comment', function get(req, res) { res.send("err1") }) -server.listen(process.argv[1] | process.env.PORT | 8080) +let PORT = process.argv[2] +if(!PORT) PORT = process.env.PORT +if(!PORT) PORT = 8080 +server.listen(Number(PORT), () => console.log(PORT)) diff --git a/posts.json b/posts.json index 7f51d7a..b79e34a 100644 --- a/posts.json +++ b/posts.json @@ -1,15 +1 @@ -[ - { - "title": "Default post", - "content": "This is the first post, it was here since the beginning.\n(Remove the space after the '[' and before the ']')\n [ * [* text *] * ] [ ** [** text **] ** ] [ *** [*** text ***] *** ] [ _ [_ text _] _ ] [ *_ [*_ text _*] _* ] [ **_ [**_ text _**] _** ] [ ***_ [***_ text _***] _*** [ **_ [**_ text _**] _** ] [ ***_ [***_ text _***] _*** ] [ \" [\" text \"] \" ]", - "author": "root", - "comments": [ - { - "title": "The first comment", - "content": "This is the first comment, it was here since the beginning.", - "author": "Anonymous", - "comments": [] - } - ] - } -] +[{"title":"Default post","content":"This is the first post, it was here since the beginning.\n(Remove the space after the '[' and before the ']')\n [ * [* text *] * ] [ ** [** text **] ** ] [ *** [*** text ***] *** ] [ _ [_ text _] _ ] [ *_ [*_ text _*] _* ] [ **_ [**_ text _**] _** ] [ ***_ [***_ text _***] _*** [ **_ [**_ text _**] _** ] [ ***_ [***_ text _***] _*** ] [ \" [\" text \"] \" ]","author":"root","comments":[{"title":"The first comment","content":"This is the first comment, it was here since the beginning.","author":"Anonymous","comments":[]}]}] \ No newline at end of file