Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
const Koa = require('koa');
const Router = require('koa-router');
const cors = require('@koa/cors');
const app = new Koa();
const router = new Router();
//this lets the API make cross origin requests
const corsOptions = {
origin: 'https://open-saddle-3000.codio-box.uk',
}
router.get('/api', welcomeAPI);
function welcomeAPI(ctx) {
ctx.body = {
message: 'This is the root of the API'
}
}
const articles = require('./routes/articles.js');
//const special = require('./routes/special.js');
app.use(router.routes());
//app.use(special.routes());
app.use(articles.routes());
app.use(cors(corsOptions));
// run the app on port 3000
//let port = process.env.PORT || 3000;
app.listen(3000);