Skip to content

Instantly share code, notes, and snippets.

@vsavkin
Created October 9, 2018 16:27
Show Gist options
  • Save vsavkin/81d292942778977f0e5c77a1453ce2ac to your computer and use it in GitHub Desktop.
Save vsavkin/81d292942778977f0e5c77a1453ce2ac to your computer and use it in GitHub Desktop.
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