Created
October 2, 2018 23:25
-
-
Save ozanmuyes/2e666455b0d408bccb6f1e4cd4f133b4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Koa = require('koa'); | |
const mongoose = require('mongoose'); | |
// Excerpted from https://mongoosejs.com/docs/index.html | |
mongoose.connect('mongodb://localhost/test'); | |
var db = mongoose.connection; | |
db.on('error', console.error.bind(console, 'connection error:')); | |
db.once('open', function() { | |
// we're connected! | |
app.listen(3000); // Start listening here | |
}); | |
// Excerpted from https://koajs.com/#application | |
const app = new Koa(); | |
app.use(async (ctx) => { | |
ctx.body = 'Hello World'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment