Skip to content
Snippets Groups Projects
Commit da504660 authored by Jérémie BRISON's avatar Jérémie BRISON
Browse files

fix(search) : use proxy

parent 8cde8224
No related branches found
No related tags found
3 merge requests!14Recette,!13Dev,!6Topic search
{
"/api/*": "/$1"
}
const jsonServer = require('json-server');
const server = jsonServer.create();
const router = jsonServer.router('db.json');
const middlewares = jsonServer.defaults();
const routes = {
'/api/*': '/$1',
};
const middlewares = [jsonServer.defaults(), jsonServer.rewriter(routes)];
// Set default middlewares (logger, static, cors and no-cache)
server.use(middlewares);
// Add custom routes before JSON Server router
server.get('/structures/count', (req, res) => {
console.log('ok');
let structureCountTab = [];
// Compétences de base
structureCountTab.push({ id: 260, count: 3 });
......
......@@ -17,7 +17,7 @@ export class SearchService {
.pipe(map((data: any[]) => data.map((item) => new Category(item))));
}
public getFakeCounterModule(): Observable<any> {
return this.http.get('http://localhost:3000/structures/count');
return this.http.get('/api/structures/count');
}
public setCountModules(category: Category, structureCountTab: { id: number; count: number }[]): Category {
category.modules.forEach((m: Module) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment