How to get into json file in emberjs?

Hai Velugu,

I’m not sure what you’re trying to do exactly because you haven’t explained it clearly in your question. If you just want to access a .json file in your Ember app, you can use Express in /server/mocks/your-things.js to mock a response when your app hits the app/v1/my-things endpoint.

/*jshint node:true*/
module.exports = function(app) {
  var express = require('express');
  var myThingsRouter = express.Router();
  var fs = require('fs');
  var myThings = JSON.parse(
    fs.readFileSync('./app/mocks/fixtures/things.json')
  );

  myThingsRouter.get('/', function(req, res) {
    res.send(myThings);
  });

  app.use('/api/v1/my-things'), myThingsRouter);
};
1 Like