refactor to use nrml/server package for json responses