1. Environment Setup

Set up your environment

Make sure your development environment includes Node.js and an npm package manager.

To check if you have Node.js installed, run this command in your terminal:

node -v

To confirm that you have npm installed, you can run this command in your terminal:

npm -v

Install Create React App

You'll need to have Node v8.16.0 or Node v10.16.0 or a later version on your machine.

npx create-react-app my-first-hat-app

If you use npm 5.1 or earlier you can't use npx. Instead, install create-react-app globally:

npm install -g create-react-app
create-react-app my-first-hat-app

And you can start by typing:

cd my-first-hat-app
npm start

Then open http://localhost:3000/ to see your app.

Testing HATs are configured to support requests from https://localhost:3000 by default. If you run the project locally on a different port, the requests will not come through by the CORS policy.

Install HAT-JS

Now you can install the HAT-JS:

npm install @dataswift/hat-js

You'll need to restart the server every time you install a package using npm. You can use Ctrl + C to stop the server and npm start to start the server.

Last updated