Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bryanjhv/nowdev
Fast and simple web server for prototyping anything.
https://github.com/bryanjhv/nowdev
Last synced: about 2 months ago
JSON representation
Fast and simple web server for prototyping anything.
- Host: GitHub
- URL: https://github.com/bryanjhv/nowdev
- Owner: bryanjhv
- License: agpl-3.0
- Created: 2020-06-06T05:34:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-24T04:10:37.000Z (about 2 years ago)
- Last Synced: 2024-05-02T01:24:17.273Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# nowdev
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.
## Installation
```bash
mkdir -p ~/bin
git clone https://github.com/bryanjhv/nowdev.git ~/.nowdev
cd ~/.nowdev
npm install
ln -s ~/.nowdev/server.js ~/bin/nowdev
```## Usage
Simply run `nowdev` in a folder.
But... keep in mind the following:- Simple file server:
Make sure there is no `api` folder.
Make sure there is no `public` folder.- Simple Node.js API:
Keep your endpoints in `api` folder.
Files like `[id].js` allow param passing.
Export an Express handler (`req`and `res`).- Mixing of previous:
Put your static files in `public` 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!## Example
Given this tree:
```tree
.
|- api
| |- index.js
| |- users
| | `- [id].js
| `- users.js
`- public
`- index.html
```Generated routes are:
```text
/ # public
/api # api/index.js
/api/users # api/users.js
/api/users/:id # api/users/[id].js
```## More features
For now it fits my use case, but you can contribute.
Anything accepted as long as it's kept simple/minimal.## License
This project is released under the [AGPLv3 license](license.txt).