简单的服务器
Posted heidekeyi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单的服务器相关的知识,希望对你有一定的参考价值。
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`);
);
以上是关于简单的服务器的主要内容,如果未能解决你的问题,请参考以下文章