-
Notifications
You must be signed in to change notification settings - Fork 3
Getting started: Configuring your Ragu Server
Maniero edited this page Sep 14, 2020
·
7 revisions
If you does not have a node project set. Run npm init inside the project path before start.
# Install ragu-server npm install ragu-server # create ragu-config.js npx ragu-server init # The directory where components should live. # You can change the path at the ragu-config.js mkdir components
And add this entry at you package.json:
{
"scripts": {
"build": "ragu-server build",
"start": "ragu-server run",
"dev": "ragu-server dev"
}
}Start creating a file called components/hello-world/view.js.
export default { render({name}) { return { html: `<h1>Hello, ${name}</h1>` } } }
Also we need an hydration file components/hello-world/hydrate.js.
export default { hydrate(el, {name}) { el.addEventListener('click', () => alert('Hello, ${name}!')); } }
npm run dev
npm run build npm run start
Check the component live http://localhost:3101/preview/hello-world/?name=World