Skip to content

Instantly share code, notes, and snippets.

@ozanmuyes
Created October 2, 2018 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozanmuyes/2e666455b0d408bccb6f1e4cd4f133b4 to your computer and use it in GitHub Desktop.
Save ozanmuyes/2e666455b0d408bccb6f1e4cd4f133b4 to your computer and use it in GitHub Desktop.
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