码迷,mamicode.com
首页 > 其他好文 > 详细

简单的服务器

时间:2019-06-17 17:20:05      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:style   async   router   bsp   new   span   server   fun   code   

const koa = require(‘koa‘),
    app = new koa(),
    Router = require(‘koa-router‘),
    router = new Router(),
    host = ‘127.0.0.1‘,
    port = 12899,
    jsonwebtoken = require(‘jsonwebtoken‘),
    jwt = require(‘koa-jwt‘);

router.get(‘/‘, async function (ctx, next) {
    ctx.body = ‘hello world‘;
});

app.use(router.routes());

app.listen(port,host, function () {
    console.log(`server is running in http://${host}:${port}`);
});

 

const koa = require(‘koa‘),
app = new koa(),
Router = require(‘koa-router‘),
router = new Router(),
host = ‘127.0.0.1‘,
port = 12899,
jsonwebtoken = require(‘jsonwebtoken‘),
jwt = require(‘koa-jwt‘);

router.get(‘/‘, async function (ctx, next) {
ctx.body = ‘hello world‘;
});

app.use(router.routes());

app.listen(port,host, function () {
console.log(`server is running in http://${host}:${port}`);
});

简单的服务器

标签:style   async   router   bsp   new   span   server   fun   code   

原文地址:https://www.cnblogs.com/heidekeyi/p/11040635.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!