Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
27 additions
and
23 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,25 @@ | ||
const Koa = require('koa'); | ||
const cors = require('@koa/cors'); | ||
const app = new Koa(); | ||
|
||
|
||
|
||
app.use(cors()); | ||
/* | ||
* Define route handler(s): | ||
* | ||
* This means we connect HTTP methods: GET, POST, ... | ||
* and URI paths: /some/uri/path | ||
* to JavaScript functions that handle the request. | ||
* | ||
* Once defined we then add them to the app object. | ||
*/ | ||
|
||
const users = require('./routes/users.js'); | ||
const applications = require('./routes/applications.js'); | ||
app.use(users.routes()); | ||
app.use(applications.routes()); | ||
|
||
let port = process.env.PORT || 3000; | ||
|
||
app.listen(port); |
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,25 +1,4 @@ | ||
const Koa = require('koa'); | ||
const cors = require('@koa/cors'); | ||
const app = new Koa(); | ||
|
||
|
||
|
||
app.use(cors()); | ||
/* | ||
* Define route handler(s): | ||
* | ||
* This means we connect HTTP methods: GET, POST, ... | ||
* and URI paths: /some/uri/path | ||
* to JavaScript functions that handle the request. | ||
* | ||
* Once defined we then add them to the app object. | ||
*/ | ||
|
||
const users = require('./routes/users.js'); | ||
const applications = require('./routes/applications.js'); | ||
app.use(users.routes()); | ||
app.use(applications.routes()); | ||
|
||
const app = require('./app'); | ||
let port = process.env.PORT || 3000; | ||
|
||
app.listen(port); | ||
console.log(`API server running on port ${port}`) |