-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made microservices easier to locally develop.
- Loading branch information
Uzziah Eyee
committed
Apr 30, 2019
1 parent
f0b0bb4
commit fc7f7a7
Showing
10 changed files
with
497 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Attach to api-server container", | ||
"type": "node", | ||
"request": "attach", | ||
// should match the exposed debug address specified in docker-compose | ||
"address": "localhost", | ||
"port": 9229, | ||
"protocol": "inspector", | ||
// you typically copy the src folder into a location in docker...specify this mapping. | ||
"localRoot": "${workspaceFolder}/api-server/src", | ||
"remoteRoot": "/usr/src/app" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.env | ||
/node_modules | ||
node_modules | ||
npm-debug.log | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
PORT= | ||
# TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
// const dotenv = require('dotenv') | ||
// if (process.env.NODE_ENV !== 'production') { | ||
// const result = dotenv.config() | ||
// if (result.error) { | ||
// throw result.error | ||
// } | ||
// } | ||
|
||
const app = require('express')() | ||
const uuid = require('uuid/v1') | ||
|
||
app.use('/api/v1/tokens', (req, res) => { | ||
console.log(`Handling request for token`) | ||
res.json({token: uuid()}) | ||
}) | ||
|
||
const server = app.listen(process.env.PORT, () => { | ||
app.use('/api/v1/whereami', (req, res) => { | ||
// TODO: get geolocation info from IP address | ||
// TODO: get weather info from geolocation | ||
// TODO: return everything | ||
let data = {'info': null} | ||
res.json(data) | ||
}) | ||
const server = app.listen(process.env.PORT || 3000, () => { | ||
console.log(`Listening on ${ server.address().address }:${ server.address().port }`) | ||
}) |
Oops, something went wrong.