Created
October 9, 2018 16:27
-
-
Save vsavkin/81d292942778977f0e5c77a1453ce2ac to your computer and use it in GitHub Desktop.
This file contains hidden or 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 * as express from 'express'; | |
const app = express(); | |
interface Ticket { | |
id: number; | |
title: string; | |
} | |
const tickets: Ticket[] = [ | |
{ | |
id: 1, | |
title: 'Login page is broken' | |
}, | |
{ | |
id: 2, | |
title: 'Everything is broken' | |
} | |
]; | |
app.get('/api/tickets', (req, res) => { | |
res.send(JSON.stringify(tickets)); | |
}); | |
const port = 3333; | |
app.listen(port, (err) => { | |
if (err) { | |
console.error(err); | |
} | |
console.log(`Listening at http://localhost:${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment