Skip to content

Deployments Azure json server

Daniel Cañizares Corrales edited this page Sep 23, 2019 · 2 revisions

Before start

VSTS vs Kudu deployments

Kudu

General steps: Create an App Service. Wait till it's implemented, then go to the Deployment Center and configure your Repo with the Kudu path.

Azure Deployment Center

Kudu/SCM console portal: To access Kudu/SCM console portal navigate to http://MYAPPSERVICE.scm.azurewebsites.net. For more information check this link

json-server

  1. Add "engines": {"node": "^10.14.1"} to the package.json (to see all available Node versions check Deployment Center logs after finishing all these steps). See sample JSON file

  2. Create a file named server.js on the project's root folder with the following content:

    const jsonServer = require('json-server')
    const server = jsonServer.create()
    const router = jsonServer.router('db.json')
    const middlewares = jsonServer.defaults()
    
    server.use(middlewares)
    server.use(router)
    server.listen(process.env.PORT, () => {
      console.log('JSON Server is running!')
    })
  3. Your CI build is ready just Commit and Push your changes.