https://serverless-stack.com/ logo
#sst
Title
# sst
s

Selo

04/03/2022, 5:14 PM
Hi, I am new to SST so I followed the Guide book to create the Notes app which worked fine. However when I created a new table and built new API for the new table, the API for the new table works fine, but now I don’t have access to the Notes API anymore. Is there a specific way we need to organize our apiStack to handle API calls in different tables?
t

thdxr

04/04/2022, 12:46 PM
can you explain more what you mean by not having access to your api?
if you moved it to a different stack it will have been recreated and have a new url
s

Selo

04/04/2022, 5:33 PM
@thdxr after doing more investigation, it seems like the app is using a single-table design that's why I am only able to access APIs of one table. Now I am looking for a way to hand multiple tables.
t

thdxr

04/04/2022, 6:36 PM
generally you should try to stick to a single table
if you need to use multiple tables that shouldn't be a problem, just pass in another env variable for your second table and reference it in your api calls
s

Selo

04/04/2022, 6:47 PM
@thdxr my project is to build an E-commerce with different vendors. So do you think single-table is suitable for this or? I am new to this single table idea.
t

thdxr

04/04/2022, 7:58 PM
if you're new to dynamo I'd recommend sticking to a single table and learning about single table design - this is a good library which implements the ideas behind it: https://github.com/tywalch/electrodb
you'd make sure all your partition keys include vendor_id in them so the data is separate
s

Selo

04/04/2022, 8:01 PM
Thanks, I appreciate it