Created
August 8, 2019 16:57
-
-
Save vsavkin/d2c8a745c48045d89a414be0e1bb13b4 to your computer and use it in GitHub Desktop.
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 * 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