xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

mongodb & vue & node.js

mongodb

mongodb & vue & node.js

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/

https://stackoverflow.com/questions/2404742/how-to-install-mongodb-on-windows

https://www.tutorialspoint.com/mongodb/
https://www.tutorialspoint.com/mongodb/mongodb_tutorial.pdf

https://docs.mongodb.com/manual/mongo/


KOA

https://github.com/koajs/koa
https://koajs.com/


$ nvm install 7
# node.js 7 +
$ nvm install 10

$ npm i koa
$ node koa-app.js


const Koa = require('koa');
const app = new Koa();

app.use(async ctx => {
    ctx.body = 'Hello World';
});

app.listen(3000);


const Koa = require('koa');
const app = new Koa();

// logger
app.use(async (ctx, next) => {
    await next();
    const rt = ctx.response.get('X-Response-Time');
    console.log(`${ctx.method} ${ctx.url} - ${rt}`);
});

// x-response-time
app.use(async (ctx, next) => {
    const start = Date.now();
    await next();
    const ms = Date.now() - start;
    ctx.set('X-Response-Time', `${ms}ms`);
});

// response
app.use(async ctx => {
    ctx.body = 'Hello World';
});

app.listen(3000);

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2018-10-10 10:20  xgqfrms  阅读(107)  评论(6编辑  收藏  举报