In this project you will build a Tourio App, the best friend of all travelers: it displays sights you want to visit and lets you edit them.
- Set up a database; use the
lib/db.json
file to insert sample data. - In
pages/api/index.js
, replace theplaces
variable imported fromlib/db.js
with aGET
request from your database. - Do the same in
pages/api/[id]/index.js
for the details page.
- In
pages/create.js
, write theaddPlace
function to start aPOST
request. - Write the
POST
API route inpages/api/places/index.js
. - Submitting the form should redirect the user to the homepage
/
.
- In
pages/places/[id]/edit.js
, write theeditPlace
function to start aPATCH
request. - Write the
PATCH
API route inpages/api/[id]/index.js
- In
pages/places/[id].index.js
, write thedeletePlace
function to start aDELETE
request. - Write the
DELETE
API route inpages/api/places/[id]/index.js
.
- Deploy your app to Vercel and make sure the deployment can access the cloud database with the help of environment variables.
To run project commands locally, you need to install the dependencies using npm i
first.
You can then use the following commands:
npm run dev
to start the development servernpm run build
to create a production buildnpm run start
to start the production buildnpm run test
to run the tests in watch mode (if available)
💡 This project requires a bundler. You can use
npm run dev
to start the development server. You can then view the project in the browser athttp://localhost:3000
. The Live Preview Extension for Visual Studio Code will not work for this project.