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 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/9764846.html
未经授权禁止转载,违者必究!