Skip to content

Instantly share code, notes, and snippets.

@Dakuan
Created December 22, 2017 10:13
Show Gist options
  • Save Dakuan/3be2158a39c7acbdca053c036bb92e3e to your computer and use it in GitHub Desktop.
Save Dakuan/3be2158a39c7acbdca053c036bb92e3e to your computer and use it in GitHub Desktop.
const express = require("express")
const moment = require("moment")
const app = express()
app.get("/api/expected-date/:invoiceId", (req, res) => {
const invoiceId = parseInt(req.params.invoiceId)
// ¯\_(ツ)_/¯
const bump = Math.floor(Math.random() * 10) + 1
const expectedDate = moment().add(bump, 'days').toISOString()
res.json({
invoiceId,
expectedDate
})
})
const port = process.env.PORT || 8080
app.listen(port, () => {
console.log(`invoices_svc listening on ${port}`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment