Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Todo Tutorial#2

Open
y471n wants to merge 9 commits intomasterfrom
todo-tutorial
Open

Todo Tutorial#2
y471n wants to merge 9 commits intomasterfrom
todo-tutorial

Conversation

@y471n
Copy link
Collaborator

@y471n y471n commented Jun 9, 2020

No description provided.

@y471n y471n requested a review from evantahler June 9, 2020 15:27
Copy link
Member

@evantahler evantahler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a. great start! Well done! I've scattered some line comments below, but overall:

  • Based on a common tutorial pattern, which is probably a good idea!
  • Clear and easy to read
  • I think naming the model Task might be confusing, as Actionhero already has a main object called "Task". Perhaps renaming this to TODO or Chore might clear this up.

I think it's going to be important to add a UI as well, so new people can see what the end result it and not need to imagine it. Perhaps grabbing the source from https://github.com/tastejs/todomvc/tree/gh-pages/examples/react and checking it into /public to wire up to the API would be a good idea?

At the end of this, we can publish this to todo.actionhero.js and have a working demo!


4. Configure the database connection in `./src/config/sequelize.js` and run migrations.
```
npx sequelize-cli db:migrate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automigrate is enabled in config/sequelize.ts, so this isn't needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But doesn't it require a restart of dev server?
That is why I added it, Will remove the whole sequelize-cli thing, it was conflicting anyways.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left it there but added the comment about auto-migration feature available in AH.
Let me know if it works for you otherwise I'll remove it.

README.md Outdated

5. Start Dev server and access API's at <a href="http://localhost:8080">Localhost</a>
```
npm run test actions/task
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this test command do? Looks like just normal npm test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this just specifically tests actions/task.ts.
Since we are following the tutorial, we first test models/task.ts and then actions/task.ts


```
npx actionhero generate
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to note what this command does - creates a new Actionhero project, package.json, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

README.md Outdated

Start the server by running:

`npm start`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably better to get folks into the habit of running npm run dev instead - this way they don't need to worry about compiling their changes

README.md Outdated

Check the directory structure and note the following:

- The preconfigured scripts are available in `todo/package.json`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just pacakge.json i think (relative to project root)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

```

This in turn makes the CLI use configuration from `src/config/sequelize.js`.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, they will need to make a database createdb actionhero or similar

README.md Outdated

```

This code is self explanatory but for further clarity the above test checks if a new task gets created in the database with the required properties.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to avoid language like "self explanatory" - this could be insulting to a new reader who doesn't understand it (this is likely a cultural thing). I tend to say something like:

This code checks if a new task gets created in the database with the required properties. To learn more about Jest tests, visit the jest website

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Fixed.

Comment on lines +9 to +11
let database = "ahtodotutorial";
let username = "ymmy";
let password = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think hard-coding a database name is OK if you tell people to create a database of the same name in the README. I'd remove the name here. Postgres, by default, will use the currently logged in user, which is normally a safe default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this for now. I've added in the description about replacing it with their own configurations.

@evantahler
Copy link
Member

It also seems you are missing the migration to create the Task model (pending rename)

y471n added 3 commits June 13, 2020 09:21
- Tasks are internally used in AH, hence for clarity purposes we
  are renaming Todo to Bucket List and Task Models and Actions to
  Goals
@y471n y471n requested a review from evantahler June 13, 2020 04:48
@y471n
Copy link
Collaborator Author

y471n commented Jun 13, 2020

I've made the necessary changes to the backend. Will work next on the demo frontend react-app.

@evantahler
Copy link
Member

Hello @y471n! I wanted to check in and see how this was going. Anything you need from me?

@evantahler
Copy link
Member

@y471n is it safe to assume this project is abandoned?

@evantahler
Copy link
Member

I'm going to archive this project. We can un-archive it if you come back!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants