Skip to content

localhost:8000/posts not display all records #1

@gfmoore

Description

@gfmoore

Hi, just experimenting. Found that the code won't display all the records when used without the /1

This seemed because it was trying to do a SELECT * WHERE id="NULL"

so I stuck the following code in:

switch (req.method) {
case 'GET':
if (key === "NULL") {
sql = "select * from " + table;
}
else {
sql = "select * from " + table + (key ? " where id=" + key : '');
}
break;

Hope this makes sense.

There may be a more elegant way :)

ps I just want to say thanks for all the work you have done on this project - I've found it very useful for my personal projects and learning about RESTful services. Thanks.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions