๐—œ ๐—•๐˜‚๐—ถ๐—น๐˜ ๐—” ๐—ฅ๐—˜๐—ฆ๐—ง ๐—”๐—ฃ๐—œ ๐—ช๐—ถ๐˜๐—ต๐—ผ๐˜‚๐˜ ๐—” ๐——๐—ฎ๐˜๐—ฎ๐—ฏ๐—ฎ๐˜€๐—ฒ

I learned Express.js for two weeks. No bootcamps. No courses. Only a roadmap and three hours a day.

I built a REST API for my real estate agency. I used in-memory arrays instead of a database.

Here is what I learned.

Organize your files. Do not put everything in one file. Give each file one job. This makes your code easy to change.

Data storage. Node.js caches modules. All files use the same array. This acts as a fake database.

Middleware logic. The next() function is key. It passes the request forward. Without it, your app freezes.

Error handling. Error handlers need four arguments. Put them last in your app. Always send a status code and a message.

Common mistakes.

What is next. I will add PostgreSQL, Prisma, and JWT.

Source: https://dev.to/chinwuba_jeffrey/i-built-a-rest-api-from-scratch-with-no-database-heres-everything-i-learned-lp2