developit / express-es6-rest-api

:battery: Starter project for an ES6 RESTful Express API.
http://git.io/express-es6-rest-api
MIT License
2.46k stars 552 forks source link

How add custom API? #42

Closed kkak10 closed 6 years ago

kkak10 commented 6 years ago

I want add custom api without 'get', 'read', 'put', 'patch', 'update', 'del', 'delete'.

developit commented 6 years ago

Use an Express Router, same as in any Express app:

import { Router } from 'express';

export default config => {
  let routes = Router();

  routes.put('/', (req, res, next) => {
    res.json({ hello: 'world' });
  });

  return routes;
}