Fast and simple web server for prototyping anything.
Reloads changes automatically for API routes and static.
Inspired by the old (more complicated) now dev
by Vercel.
mkdir -p ~/bin
git clone https://github.com/bryanjhv/nowdev.git ~/.nowdev
cd ~/.nowdev
npm install
ln -s ~/.nowdev/server.js ~/bin/nowdev
Simply run nowdev
in a folder.
But... keep in mind the following:
-
Simple file server:
Make sure there is noapi
folder.
Make sure there is nopublic
folder. -
Simple Node.js API:
Keep your endpoints inapi
folder.
Files like[id].js
allow param passing.
Export an Express handler (req
andres
). -
Mixing of previous:
Put your static files inpublic
folder.
You can use whatever you want in API.
Use export default
if you like that way.
Or maybe async await
makes you happier.
And the old ones will prefer module.exports
...
Just keep doing your stuff and that's it, so simple!
Given this tree:
.
|- api
| |- index.js
| |- users
| | `- [id].js
| `- users.js
`- public
`- index.html
Generated routes are:
/ # public
/api # api/index.js
/api/users # api/users.js
/api/users/:id # api/users/[id].js
For now it fits my use case, but you can contribute.
Anything accepted as long as it's kept simple/minimal.
This project is released under the AGPLv3 license.