Skip to content
Permalink
Browse files
create app.js and make new index.js
  • Loading branch information
skondram committed Nov 27, 2021
1 parent 61b37f8 commit af1c00671d04fa6dad524ac3d241c44b3fdbd694
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
25 app.js
@@ -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);
@@ -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}`)

0 comments on commit af1c006

Please sign in to comment.