Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create REST routes on SB Admin React Starter Kit #66

Open
daniramdani opened this issue Nov 3, 2016 · 3 comments
Open

How to create REST routes on SB Admin React Starter Kit #66

daniramdani opened this issue Nov 3, 2016 · 3 comments

Comments

@daniramdani
Copy link

daniramdani commented Nov 3, 2016

Hi koistya, I'm newbie in React JS, I'm using SB Admin React Starter Kit to create my app, I wish to create kind REST routes :

http://example.com/users
http://example.com/users/1
http://example.com/users/create
http://example.com/users/add

But I can't figure out how to make it, may you can help me to solve my problem ?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38907533-how-to-create-rest-routes-on-sb-admin-react-starter-kit?utm_campaign=plugin&utm_content=tracker%2F18115217&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F18115217&utm_medium=issues&utm_source=github).
@frenzzy
Copy link
Member

frenzzy commented Nov 3, 2016

import { resolve } from 'universal-router'

const routes = {
  path: '/users',
  children: [
    { path: '/', action() { return 'Users' } },
    { path: '/create', action() { return 'Create User' } },
    { path: '/add', action() { return 'Add User' } },
    { path: '/:id', action(context) { return `User #${context.params.id}` } },
  ]
}

resolve(routes, '/users/1').then(result => {
  document.body.innerHTML = result
})

Playground: https://jsfiddle.net/frenzzy/pg0ouyxm/

@daniramdani
Copy link
Author

Hi frenzzy,

Thanks for your response, how to implemet with SB Admin React Starter Kit ?

Thanks

@frenzzy
Copy link
Member

frenzzy commented Nov 3, 2016

Add by analogy with other routes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants