Most services exist to interact with a TPEN Project Entity in some way. Once the design of a TPEN Project Entity becomes clear, create a 'TPENProject' class for TPEN Services to work with.
An example of how TPEN Services would could do GET /manifest/123 using a Project class.
router.route('/:id')
.get((req, res, next) => {
let id = req.params.id
id = parseInt(id)
const project = new TPENProject(id)
// Projects only have one manifest so will have a simple 'getter' for this
const manifestObj = await project.getManifest()
if(manifestObj){
respondWithManifest(res, manifestObj)
}
else{
utils.respondWithError(res, 404, `TPEN 3 project "${id}" does not exist.`)
}
})
.all((req, res, next) => {
utils.respondWithError(res, 405, 'Improper request method, please use GET.')
})
Most services exist to interact with a TPEN Project Entity in some way. Once the design of a TPEN Project Entity becomes clear, create a 'TPENProject' class for TPEN Services to work with.
An example of how TPEN Services would could do
GET /manifest/123
using a Project class.