Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Using express.js GET Ressource in in-repo-addon

$
0
0

@GELight wrote:

Hi all,

I search an example where I can define REST Ressources ( GET, POST, … ) in a simple in-repo-addon for the development time until I have a real node project for my backend etc…

I created my in-repo-addon by ember-cli. This is my addon package.json - ( its a copy of an running example from another project )::

{
  "name": "test-backend",
  "keywords": [
    "ember-addon"
  ],
  "ember-addon": {
    "before": [
      "serve-files-middleware",
      "history-support-middleware",
      "proxy-server-middleware"
    ]
  }
}

… and this is my Test-Server with my first Ressource:

/* eslint-env node */
'use strict';

module.exports = {
  name: 'test-backend',

  isDevelopingAddon() {
    return true;
  },

  serverMiddleware({app}) {
    console.log('init test backend - /api - v1.0');

    app.get('/activities', (req, res) => {
      console.log(req.params);
    });

  }
};

If I start my server there are no errors in my log. But my application is stopping with

GET http://localhost:4200/api/activities 404 (Not Found)

I do not know what is wrong… :frowning: No help found in documentation or google too…

Best regards, Mario

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles