0.1.0-beta.6 • Published 3 months ago

samsun v0.1.0-beta.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

samsun 🌃

NPM Version NPM Downloads NPM License

Samsun is a free and open source Backend server framework for complex, scalable or basic functional servers for applications.

Samsun contains many features that will shorten the development time for your server. Like:

  • File based route
  • Error handlers
  • No config needed
  • Extensible with plugins
  • Hot refresh
  • And more...

Getting Started

You can start your project by downloading Samsun and Samsu.

npm install samsum samsu

What you need to do next is to create files and define defult exported functions for them.

The value returned by the function will be sent automatically.

index.js:

export default function (req, res) {
  return 'Hello from server!'
}

Development

To start a server with hot refresh and error messages, simply use the samsu command to start a test server.

samsu

If you want to change anything related to the server or many other things in the development section, you can create a config file.

samsun.config.js:

import { defineConfig } from 'samsun'

export default defineConfig({
  server: {
    port: 5555
  }
})

You can also use the samsu --config=(config) command to use different config files in different situations.

samsun.config.prod.js:

import { defineConfig } from 'samsun'

export default defineConfig({
  server: {
    port: 3000
  }
})
samsu --config=samsun.config.prod.js

Restful API

Samsun is great for building complex APIs. Instead of defining the route of many files one by one, just name them.

api/v1.js:

export default function (req, res) {
  return {
    status: 'ok'
  }
}

When you go to route /api/v1 a json like this will be returned:

{
  "status": "ok"
}

Plugins

You can change the output with the defineConfig function, or by specifying a plugin you downloaded from npm in the config file.

import { defineConfig } from 'samsun'
import myPlugin from 'samsun-plugin-myPlugin'

export default defineConfig({
  plugins: [myPlugin()]
})

We will explain this in more detail when we create a documentation site.

License

MIT

0.1.0-beta.3

3 months ago

0.1.0-beta.2

3 months ago

0.1.0-beta.5

3 months ago

0.1.0-beta.4

3 months ago

0.1.0-beta.1

3 months ago

0.0.0-beta.20

3 months ago

0.0.0-beta.22

3 months ago

0.1.0-beta.6

3 months ago

0.0.0-beta.21

3 months ago

0.0.0-beta.24

3 months ago

0.0.0-beta.23

3 months ago

0.0.0-beta.15

3 months ago

0.0.0-beta.14

3 months ago

0.0.0-beta.11

3 months ago

0.0.0-beta.13

3 months ago

0.0.0-beta.12

3 months ago

0.0.0-beta.10

3 months ago

0.0.0-beta.7

3 months ago

0.0.0-beta.6

3 months ago

0.0.0-beta.5

3 months ago

0.0.0-beta.4

3 months ago

0.0.0-beta.3

3 months ago

0.0.0-beta.2

3 months ago

0.0.0-beta.1

3 months ago