Created
June 9, 2020 16:05
-
-
Save omirobarcelo/bfda9c3ffb8afe40397d7adfdf2b8970 to your computer and use it in GitHub Desktop.
Hello World Alosaur application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller, Get, Area, App } from 'https://deno.land/x/alosaur/mod.ts'; | |
@Controller('/home') | |
export class HomeController { | |
@Get('/text') | |
text() { | |
return 'Hello world'; | |
} | |
@Get('/json') | |
json() { | |
return { text: 'test' }; | |
} | |
} | |
// Declare module | |
@Area({ | |
controllers: [HomeController], | |
}) | |
export class HomeArea {} | |
// Create alosaur application | |
const app = new App({ | |
areas: [HomeArea], | |
}); | |
const PORT = Deno.env.get('PORT') || '8000'; | |
app.listen(`:${PORT}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment