There was an error while loading. Please reload this page.
In this chapter, you will learn how to create a T-Koa application.
You need to init a node project and install the latest version of typescript and t-koa first:
$ npm init $ npm i tkoa $ npm i typescript
Next, you can create an index.ts file.
index.ts
And write the following in the index.ts file:
//import tkoa import tKoa = require('tkoa'); // defined interface interface ctx { response: { end: Function } } const app = new tKoa(); // response app.use((ctx: ctx) => { ctx.response.end('Hello T-koa!'); }); app.listen(3000);
Enter in the terminal:
$ tsc -t es6 -m commonjs index.ts $ node index.js
Now that you open your browser and type localhost:3000, you can see the result.
localhost:3000
Sorry, there was an error rendering this page.