Skip to content

Instantly share code, notes, and snippets.

@vsavkin
Created August 8, 2019 16:57
Show Gist options
  • Save vsavkin/d2c8a745c48045d89a414be0e1bb13b4 to your computer and use it in GitHub Desktop.
Save vsavkin/d2c8a745c48045d89a414be0e1bb13b4 to your computer and use it in GitHub Desktop.
import * as express from 'express';
import { Ticket } from '@happyorg/data';
const app = express();
type Ticket = {
title: string;
id: number;
};
const tickets: Ticket[] = [
{
title: `Install updates`,
id: 1
},
{
title: `Restore the backup`,
id: 2
}
];
app.get('/api/tickets', (req, res) => {
res.send(tickets);
});
const port = process.env.port || 3333;
const server = app.listen(port, () => {
console.log(`Listening at http://localhost:${port}/api`);
});
server.on('error', console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment