@harperfast/template-vue-studio
v1.5.1
Published
Your new app is now deployed and running on Harper Fabric!
Keywords
Readme
your-project-name-here
Your new app is now deployed and running on Harper Fabric!
Here's what you should do next:
Define Your Schema
- Create a new yourTableName.graphql file in the schemas directory.
- Craft your schema by hand or tap "+ New Table" in the action bar for a bit of guidance.
- Save your changes.
- Tap "Restart Cluster" and your changes will be live!
These schemas are the heart of a great Harper app, specifying which tables you want and what attributes/fields they should have. Any table you @export stands up endpoints automatically.
Add Custom Endpoints
Create a new greeting.js file in the resources directory.
Customize your resource:
export class Greeting extends Resource { static loadAsInstance = false; async post( target, newRecord, ) { // By default, only super users can access these endpoints. return { greeting: 'Greetings, post!' }; } async get(target) { // But if we want anyone to be able to access it, we can turn off the permission checks! target.checkPermission = false; return { greeting: 'Greetings, get! ' + process.version }; } async put( target, record, ) { target.checkPermission = false; if (this.getCurrentUser()?.name?.includes('Coffee')) { // You can add your own authorization guards, of course. return new Response('Coffee? COFFEE?!', { status: 418 }); } return { greeting: 'Sssssssssssssss!' }; } async patch( target, record, ) { return { greeting: 'We can make this work!' }; } async delete(target) { return true; } }Save your changes.
Tap "Restart Cluster" and your changes will be live!
View Your Website
Pop open http://localhost:9926 to view web/index.html in your browser.
Use Your API
Head to the APIs tab to explore your endpoints and exercise them. You can click the "Authenticate" button to see what different users will be able to access through your API.
Test your application works by querying the /Greeting endpoint:
curl http://localhost:9926/GreetingYou should see the following:
{ "greeting": "Hello, world!" }Configure Your App
Take a look at the default configuration, which specifies how files are handled in your application.
Keep Going!
For more information about getting started with Harper and building applications, see our getting started guide.
For more information on Harper Components, see the Components documentation.
