routing
In addition to configuration for building your express app, a separate configuration file is provided to configure the routing mechanism provided by psychic. This file is located at conf/routes.ts
.
// conf/routes.ts
import { PsychicRouter } from 'psychic'
export default (r: PsychicRouter) => {
r.namespace('api', r => {
r.namespace('v1', r => {
r.namespace('host', r => {
r.resources('places')
})
})
})
}
GET api/v1/host/places Api/V1/Host/Places#index POST api/v1/host/places Api/V1/Host/Places#create GET api/v1/host/places/:id Api/V1/Host/Places#show PUT api/v1/host/places/:id Api/V1/Host/Places#update PATCH api/v1/host/places/:id Api/V1/Host/Places#update DELETE api/v1/host/places/:id Api/V1/Host/Places#destroy
The routes API is quite robust. For more information on available methods, see our routing guides.